Msvc++ 2005 Ee .... Please Help


trucidare

Member
Joined
Apr 16, 2006
Messages
183
hello,

today i will begin to program in c++. I´ve downloaded MSVC++ few days before and tried to setting up it for using GCC compiler. I worked with the wiki tutorial.
Now i have some trouble. when i press build there are many undefined reference failures in the linking part.

can someone help me?

thanks
trucidare
 
I suggest:
1. The Gamepark Holdings Software Developer's Kit available from Gamepark at http://dev.gp2x.com/sdk/gp2xsdk_windows.zip

This kit includes the Bloodshed devC++ integrated development environment, GCC versions for both gp2x native and MS-Windows native executables, and copies of the Linux version 2.4.25 libraries. It will compile gp2x native code for executables using shared libraries in addition to the static library form.
Simply a lot easier then setting up MSVC. Simply extract and go.
 
yes its very easy, but we wouldn´t use devcpp.
Can someone help me to set up MSVC++?
 
Have you checked that all the linker and include paths are correct?
Have you included the neccasary libraries for the project?
 
i have add to the additional path: C:\devkitpro\devkitgp2x\lib
and the line below: SDL.lib and SDLmain.lib

the failure is cannot find ...... -lsdl.lib

i need help

thanks
 
ok i will try later.

the thing is he says that he didn´t find the lib in the directory, but it is .

thanks
 
i´ve tested with SDL; SDLmain without the .lib and now i have some new failures

Code:
------ Neues Erstellen gestartet: Projekt: spiel, Konfiguration: Debug Win32 ------
Die Zwischen- und Ausgabedateien für das Projekt "spiel" mit der Konfiguration "Debug|Win32" werden gelöscht.
fire.cpp
Linking spiel.exe...
C:\devkitpro\devkitGP2X\lib\libSDL.a(SDL_syssem.o): In function `SDL_CreateSemaphore':
/home/darius/gp2x/sdl/SDL-1.2.9-GP2X/src/thread/SDL_syssem.c(103): undefined reference to `sem_init'
C:\devkitpro\devkitGP2X\lib\libSDL.a(SDL_syssem.o): In function `SDL_DestroySemaphore':
/home/darius/gp2x/sdl/SDL-1.2.9-GP2X/src/thread/SDL_syssem.c(129): undefined reference to `sem_destroy'
C:\devkitpro\devkitGP2X\lib\libSDL.a(SDL_syssem.o): In function `SDL_SemTryWait':
/home/darius/gp2x/sdl/SDL-1.2.9-GP2X/src/thread/SDL_syssem.c(144): undefined reference to `sem_trywait'
C:\devkitpro\devkitGP2X\lib\libSDL.a(SDL_syssem.o): In function `SDL_SemWait':
/home/darius/gp2x/sdl/SDL-1.2.9-GP2X/src/thread/SDL_syssem.c(165): undefined reference to `sem_wait'
C:\devkitpro\devkitGP2X\lib\libSDL.a(SDL_syssem.o): In function `SDL_SemValue':
/home/darius/gp2x/sdl/SDL-1.2.9-GP2X/src/thread/SDL_syssem.c(209): undefined reference to `sem_getvalue'
C:\devkitpro\devkitGP2X\lib\libSDL.a(SDL_syssem.o): In function `SDL_SemPost':
/home/darius/gp2x/sdl/SDL-1.2.9-GP2X/src/thread/SDL_syssem.c(230): undefined reference to `sem_post'
C:\devkitpro\devkitGP2X\lib\libSDL.a(SDL_sysmutex.o): In function `SDL_CreateMutex':
/home/darius/gp2x/sdl/SDL-1.2.9-GP2X/src/thread/SDL_sysmutex.c(72): undefined reference to `pthread_mutexattr_init'
/home/darius/gp2x/sdl/SDL-1.2.9-GP2X/src/thread/SDL_sysmutex.c(77): undefined reference to `pthread_mutexattr_setkind_np'
/home/darius/gp2x/sdl/SDL-1.2.9-GP2X/src/thread/SDL_sysmutex.c(82): undefined reference to `pthread_mutex_init'
C:\devkitpro\devkitGP2X\lib\libSDL.a(SDL_sysmutex.o): In function `SDL_DestroyMutex':
/home/darius/gp2x/sdl/SDL-1.2.9-GP2X/src/thread/SDL_sysmutex.c(96): undefined reference to `pthread_mutex_destroy'
C:\devkitpro\devkitGP2X\lib\libSDL.a(SDL_sysmutex.o): In function `SDL_mutexP':
/home/darius/gp2x/sdl/SDL-1.2.9-GP2X/src/thread/SDL_sysmutex.c(133): undefined reference to `pthread_mutex_lock'
C:\devkitpro\devkitGP2X\lib\libSDL.a(SDL_sysmutex.o): In function `SDL_mutexV':
/home/darius/gp2x/sdl/SDL-1.2.9-GP2X/src/thread/SDL_sysmutex.c(171): undefined reference to `pthread_mutex_unlock'
C:\devkitpro\devkitGP2X\lib\libSDL.a(SDL_systhread.o): In function `RunThread':
/home/darius/gp2x/sdl/SDL-1.2.9-GP2X/src/thread/SDL_systhread.c(83): undefined reference to `pthread_exit'
C:\devkitpro\devkitGP2X\lib\libSDL.a(SDL_systhread.o): In function `SDL_SYS_CreateThread':
/home/darius/gp2x/sdl/SDL-1.2.9-GP2X/src/thread/SDL_systhread.c(92): undefined reference to `pthread_attr_init'
/home/darius/gp2x/sdl/SDL-1.2.9-GP2X/src/thread/SDL_systhread.c(96): undefined reference to `pthread_attr_setdetachstate'
/home/darius/gp2x/sdl/SDL-1.2.9-GP2X/src/thread/SDL_systhread.c(99): undefined reference to `pthread_create'
C:\devkitpro\devkitGP2X\lib\libSDL.a(SDL_systhread.o): In function `SDL_SYS_SetupThread':
/home/darius/gp2x/sdl/SDL-1.2.9-GP2X/src/thread/SDL_systhread.c(117): undefined reference to `pthread_sigmask'
/home/darius/gp2x/sdl/SDL-1.2.9-GP2X/src/thread/SDL_systhread.c(123): undefined reference to `pthread_setcanceltype'
C:\devkitpro\devkitGP2X\lib\libSDL.a(SDL_systhread.o): In function `SDL_ThreadID':
/home/darius/gp2x/sdl/SDL-1.2.9-GP2X/src/thread/SDL_systhread.c(131): undefined reference to `pthread_self'
C:\devkitpro\devkitGP2X\lib\libSDL.a(SDL_systhread.o): In function `SDL_SYS_WaitThread':
/home/darius/gp2x/sdl/SDL-1.2.9-GP2X/src/thread/SDL_systhread.c(136): undefined reference to `pthread_join'
C:\devkitpro\devkitGP2X\lib\libSDL.a(SDL_systhread.o): In function `SDL_SYS_KillThread':
/home/darius/gp2x/sdl/SDL-1.2.9-GP2X/src/thread/SDL_systhread.c(142): undefined reference to `pthread_cancel'
Das Buildprotokoll wurde unter "file://c:\Dokumente und Einstellungen\Hiro\Eigene Dateien\VC++\Projekte\spiel\Debug\BuildLog.htm" gespeichert.
spiel - 0 Fehler, 0 Warnung(en)
========== Alles neu erstellen: 1 erfolgreich, Fehler bei 0, 0 übersprungen ==========

please help me
 
here my rule file:

Code:
<?xml version="1.0" encoding="utf-8"?>
<VisualStudioToolFile
 Name="GCC Compiler"
 Version="8.00"
 >
 <Rules>
  <CustomBuildRule
   Name="arm-linux-gcc"
   DisplayName="GCC Compiler"
   CommandLine="arm-linux-gcc.exe -c [AllOptions] [AdditionalOptions] -o $(IntDir)\$(InputName).o [inputs] 2&gt;&amp;1 | sed -e s/(.[a-zA-Z]\+):([0-9]\+):/\1(\2):/"
   Outputs="$(IntDir)\$(InputName).o"
   FileExtensions="*.c;*.cpp"
   ExecutionDescription="$(InputFileName)"
   >
   <Properties>
	<StringProperty
	 Name="IncludePaths"
	 DisplayName="Additional Include Paths"
	 Description="Specifies one or more directories to add to the include path; use semi-colon delimited list if more than one."
	 Switch="-I&quot;[value]&quot;"
	 Delimited="true"
	 Inheritable="true"
	/>
	<BooleanProperty
	 Name="WarningsAsErrors"
	 DisplayName="Warnings As Errors"
	 Description="Treat warnings as errors"
	 Switch="-Werror"
	/>
	<EnumProperty
	 Name="OptimizationLevel"
	 DisplayName="Optimization Level"
	 Description="Set the optimization level"
	 >
	 <Values>
	  <EnumValue
	   Value="0"
	   DisplayName="Default"
	  />
	  <EnumValue
	   Value="1"
	   Switch="-O0"
	   DisplayName="No Optimization"
	  />
	  <EnumValue
	   Value="2"
	   Switch="-O1"
	   DisplayName="Simple Optimization"
	  />
	  <EnumValue
	   Value="3"
	   Switch="-O2"
	   DisplayName="Optimize for Speed"
	  />
	  <EnumValue
	   Value="4"
	   Switch="-Os"
	   DisplayName="Optimize for Size"
	  />
	  <EnumValue
	   Value="5"
	   Switch="-O3"
	   DisplayName="Maximum Optimization"
	  />
	 </Values>
	</EnumProperty>
	<StringProperty
	 Name="PreprocessorDefines"
	 DisplayName="Preprocessor Defines"
	 Description="Specifies one or more preprocessor defines.  Separate multiple defines with a semi-colon."
	 Switch="-D[value]"
	 Delimited="true"
	 Inheritable="true"
	/>
	<EnumProperty
	 Name="WarningLevel"
	 DisplayName="Warning Level"
	 Description="Set the level of warnings that are displayed."
	 >
	 <Values>
	  <EnumValue
	   Value="0"
	   DisplayName="Default"
	  />
	  <EnumValue
	   Value="2"
	   Switch="-Wall"
	   DisplayName="All"
	  />
	 </Values>
	</EnumProperty>
   </Properties>
  </CustomBuildRule>
  <CustomBuildRule
   Name="arm-linux-link"
   DisplayName="GCC Linker"
   CommandLine="arm-linux-gcc.exe $(IntDir)\*.o -o &quot;$(TargetPath)&quot; [AllOptions] [AdditionalOptions] -static 2&gt;&amp;1 | sed -e s/(.[a-zA-Z]\+):([0-9]\+):/\1(\2):/"
   Outputs="never-exists"
   FileExtensions="*.link"
   ExecutionDescription="Linking $(TargetFileName)..."
   >
   <Properties>
	<StringProperty
	 Name="LibPaths"
	 DisplayName="Additional Library Paths"
	 Description="Specifies one or more directories to add to the lib path; use semi-colon delimited list if more than one."
	 Switch="-L&quot;[value]&quot;"
	 Delimited="true"
	 Inheritable="true"
	/>
	<StringProperty
	 Name="Libraries"
	 DisplayName="Additional Dependencies"
	 Description="Specifies one or more libraries to link to; use semi-colon delimited list if more than one."
	 Switch="-l[value]"
	 DefaultValue="pthread"
	 Delimited="true"
	 Delimiters=";, "
	 Inheritable="true"
	/>
   </Properties>
  </CustomBuildRule>
  <CustomBuildRule
   Name="arm-linux-ar"
   DisplayName="GCC Archiver"
   CommandLine="arm-linux-ar rcs [AdditionalOptions] &quot;$(TargetPath)&quot; $(IntDir)\*.o"
   Outputs="never-exists"
   FileExtensions="*.ar"
   ExecutionDescription="Creating library $(TargetFileName)..."
   >
   <Properties>
   </Properties>
  </CustomBuildRule>
 </Rules>
</VisualStudioToolFile>
 
Last edited by a moderator:
That's a generic file, which doesn't have your project's settings in it. There must be another file, so find that and post it.

It looks like you're not linking the pthread library. What is the complete linker line that you are using? The libraries that should be added would be something like -lSDL -lSDL_main -lpthread -lc -lg
 
this command:

Code:
arm-linux-gcc.exe Debug\*.o -o "c:\Dokumente und Einstellungen\Hiro\Eigene Dateien\VC++\Projekte\spiel\Debug\spiel.gpe"  -L"C:\devkitpro\devkitGP2X\lib" -lSDL -static 2>&1 | sed -e s/(.[a-zA-Z]\+):([0-9]\+):/\1(\2):/
 
Last edited by a moderator:
Back
Top