Author Topic: C Langage: SDL Projetcs does not compile !  (Read 7244 times)

Offline CSoldier

  • Single posting newcomer
  • *
  • Posts: 7
    • Les liens pour le Langage C
C Langage: SDL Projetcs does not compile !
« on: February 26, 2006, 04:22:13 pm »
Hello,

I installed Code::Blocks under Windows XP SP2, I would like to know how I can create a SDL project in C Language AND which is compiled with a "C" compiler and not MingW-g++ but rather MingW-GCC for example !

I installed SDL myself because I have not found a installer of files of development and runtime.
The headers files is in the repertory "...\include\SDL\" and the libs in "...\lib\" of the repertory of C::B.

Here the error of compilation with the default SDL project (C++) - (just for testing but I want e C/SDL project):
Code
Project   : SDL Application
Compiler  : GNU GCC Compiler (called directly)
Directory : C:\Documents and Settings\Franck\Mes documents\sdlapp\
--------------------------------------------------------------------------------
Switching to target: default
Linking console executable: SDLapp.exe
..\..\..\..\Program Files\CodeBlocks\lib\SDLmain.lib(./Release/SDL_win32_main.obj):C:\SDL-1.2.9\Src\M:(.text[_main]+0x0): multiple definition of `main'
C:\Program Files\CodeBlocks\lib/libmingw32.a(main.o):main.c:(.text+0x0): first defined here
Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized
..\..\..\..\Program Files\CodeBlocks\lib\SDLmain.lib(./Release/SDL_win32_main.obj):C:\SDL-1.2.9\Src\M:(.text[_main]+0x55): undefined reference to `_alloca_probe'
..\..\..\..\Program Files\CodeBlocks\lib\SDLmain.lib(./Release/SDL_win32_main.obj):C:\SDL-1.2.9\Src\M:(.text[_main]+0xc8): undefined reference to `SDL_SetModuleHandle'
..\..\..\..\Program Files\CodeBlocks\lib\SDLmain.lib(./Release/SDL_win32_main.obj):C:\SDL-1.2.9\Src\M:(.text[[email protected]]+0x162): undefined reference to `_alloca_probe'
..\..\..\..\Program Files\CodeBlocks\lib\SDLmain.lib(./Release/SDL_win32_main.obj):C:\SDL-1.2.9\Src\M:(.text[[email protected]]+0x1a5): undefined reference to `_alloca_probe'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 1 warnings


Thanks for all !

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: C Langage: SDL Projetcs does not compile !
« Reply #1 on: February 26, 2006, 04:38:52 pm »
Warning: .drectve `/DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"uuid.lib" /DEFAULTLIB:"MSVCRT" /DEFAULTLIB:"OLDNAMES" ' unrecognized
Firstly, it seems some MSVC commands are getting mixed up in your GCC command line. To troubleshoot this, change Compiler logging to "Full command line" in the Other tab of your global compiler settings. This will show the full command line being used to compile. You may need to create an entirely new project and add your files to it to fix this issue.

Secondly, you appear to be using the MSVC version of the SDL devel library. While GCC has limited support for MSVC libraries and object files, there are enough important differences that you would be better off downloading the MinGW32 devel package (SDL-devel-1.2.9-mingw32.tar.gz).

Thirdly, if you aren't already using one of the C::B nightly builds, switch now! They are much more feature rich and lack most of RC2's annoying bugs. (You will need to install MinGW separately, preferably using the new 5.0.2 installer.)
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

Offline CSoldier

  • Single posting newcomer
  • *
  • Posts: 7
    • Les liens pour le Langage C
Re: C Langage: SDL Projetcs does not compile !
« Reply #2 on: February 26, 2006, 05:36:35 pm »
Ok, it's better  :D Thank you... !

Last question... By creating my personnal template for a SDL project in C Language, how I makes to specify that the compiler must be a C compiler and not C++ ?  Or that's done automatically compared to the extension of the files ?

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: C Langage: SDL Projetcs does not compile !
« Reply #3 on: February 26, 2006, 08:44:37 pm »
Or that's done automatically compared to the extension of the files ?
Indeed. :)
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

Offline CSoldier

  • Single posting newcomer
  • *
  • Posts: 7
    • Les liens pour le Langage C
Re: C Langage: SDL Projetcs does not compile !
« Reply #4 on: February 26, 2006, 11:54:49 pm »
Ok  :P Thanks, that functions impeccably well   :P :P