forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Error in pspnet_adhocctl.h? struct productStruct

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
elyk1212



Joined: 08 Jun 2007
Posts: 6

PostPosted: Sun Apr 24, 2011 1:59 am    Post subject: Error in pspnet_adhocctl.h? struct productStruct Reply with quote

I received an error when Error in the linking step using -lpspnet_adhocctl and the PSP SDK header file definition of "struct productStruct" in "$PSPSDK/include/pspnet_adhocctl.h"

Old code (with error?):
Code:


/** Product structure */
struct productStruct
{
   /** Unknown, set to 0 */
   int unknown;
   /** The product ID string */
   char product[9];
} productStruct;



As far as I know, in pure C syntax this is declaring an instance named productStruct in the ending part there, since this is not a typedef, so there is my problem.

I am doing C++ linkage here (and the header is extern "C", unchanged from before), so your mileage may vary if doing pure C (psp-gcc).


I had to change the header file definition to read:
Code:



/** Product structure */
struct productStruct
{
   /** Unknown, set to 0 */
   int unknown;
   /** The product ID string */
   char product[9];
} ;


The error was:


Code:


psp-gcc -I../ -I./ -I/home/kyle2/Development/Games/PSP/Dev_ToolChains/psptoolchain/pspdev/include -I/home/kyle2/Development/Games/PSP/Dev_ToolChains/psptoolchain/pspdev/psp/include -I/home/kyle2/Development/Games/PSP/Dev_ToolChains/psptoolchain/pspdev/psp/sdk/include -I. -I/home/kyle2/Development/Games/PSP/Dev_ToolChains/psptoolchain/pspdev/psp/sdk/include -g3 -O0 -G0 -Wall -DPSP_BUILD  -D_PSP_FW_VERSION=500  -L. -L/home/kyle2/Development/Games/PSP/Dev_ToolChains/psptoolchain/pspdev/psp/sdk/lib -specs=/home/kyle2/Development/Games/PSP/Dev_ToolChains/psptoolchain/pspdev/psp/sdk/lib/prxspecs -Wl,-q,-T/home/kyle2/Development/Games/PSP/Dev_ToolChains/psptoolchain/pspdev/psp/sdk/lib/linkfile.prx   callbacks.o framebuffer.o vram.o Animate.o AudioController.o Background.o Block.o geometry.o ImageLoader.o Light.o main.o Menu.o MP3Player.o Multiplayer.o NumberImage.o PNGLoader.o PSPTexture.o PuzzleGame.o ScoreNumbers.o TGALoader.o Utilities.o VRAM.o WavPlayer.o Images/game_over_screen.o Images/hud_overlay.o Images/main_menu.o Images/paused_screen.o Images/score.o Images/score_numbers_8x15.o /home/kyle2/Development/Games/PSP/Dev_ToolChains/psptoolchain/pspdev/psp/sdk/lib/prxexports.o -lc -lstdc++ -lmikmod -lpspaudio -lpspgum -lpspgu -lpsprtc -lpng -lz -lm -lpsppower -lpspmp3 -lpspwlan -lpspusb -lpspusbstor -lpspgum -lpspgu -lm -lpspumd -lpspnet_adhocctl -lpspnet_adhocmatching -lpspnet_adhoc  -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o RazzlePuzzle.elf
PuzzleGame.o:/home/kyle2/Development/Games/PSP/Dev_ToolChains/psptoolchain/pspdev/lib/gcc/psp/4.3.2/../../../../psp/include/c++/4.3.2/exception:59: multiple definition of `productStruct'
Multiplayer.o:/home/kyle2/Development/Games/PSP/Dev_ToolChains/psptoolchain/pspdev/lib/gcc/psp/4.3.2/../../../../psp/include/c++/4.3.2/new:105: first defined here
collect2: ld returned 1 exit status
make: *** [RazzlePuzzle.elf] Error 1


By changing the header file pspnet_adhocctl.h in the SDK, I have fixed this linking problem.

Hope this helps anyone else who is running into this. It took an hour or more to figure out (since I thought somehow the library was getting double linked somewhere, etc).
Back to top
View user's profile Send private message
elyk1212



Joined: 08 Jun 2007
Posts: 6

PostPosted: Wed Jun 08, 2011 3:31 pm    Post subject: Reply with quote

Oh I forgot here are the version details from the svn repository for pspnet_adhocctl.h

* $Id: pspnet_adhocctl.h 2433 2008-10-15 10:00:27Z iwn $

Looks like revision number: 2433

So maybe there is a fix already. I didn't have a moment to check, but anyhow if you have this issue (and using struct productStruct), you'll know when you bottom out! :P

EDIT:
Patch in unified form (Just to be complete)
Code:


--- /home/user/Development/Games/PSP/Dev_ToolChains/psptoolchain/install/trunk/pspsdk/src/net/pspnet_adhocctl.h   2008-12-15 08:30:38.000000000 -0700
+++ /backup/user/Development/Games/PSP/Dev_ToolChains/psptoolchain/pspdev/psp/sdk/include/pspnet_adhocctl.h   2011-04-23 08:46:45.000000000 -0700
@@ -26,7 +26,7 @@
    int unknown;
    /** The product ID string */
    char product[9];
-} productStruct;
+} ;
 
 /** Peer info structure */
 struct SceNetAdhocctlPeerInfo
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group