You are not logged in.

#1 2011-01-19 06:42:27

archdrew
Member
Registered: 2011-01-19
Posts: 1

SDL can't find _main

Hi all,

I have set up Eclipse + CDT on an Arch 2010.05 install.  I set up an eclipse project and added SDL as a dependency (see below):

Project -> Properties
  -> GCC C++ Compiler -> Preprocessor -> main=SDL_main
  -> GCC C++ Linker -> Libraries -> SDLmain SDL (in that order top to bottom)
  -> Library Search Path -> /usr/lib/  (I verified that libSDL.a and libSDLmain.a are there)

This is the code I'm compiling.  It's designed to just be a hello world style SDL app to see that everything is working.

#include <SDL/SDL.h>

int main(int argc, char **argv)
{
    SDL_Init(SDL_INIT_VIDEO);
    SDL_Quit();
    return 0;
}

But when I compile I get this error:

Building target: client
Invoking: GCC C++ Linker
g++ -L/usr/lib/ -o"client"  ./src/engine/CEngine.o ./src/engine/main.o   -lSDLmain -lSDL
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.5.2/../../../../lib/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: ld returned 1 exit status
make: *** [client] Error 1

Anyone know how to set up Eclipse + CDT + SDL properly?

Last edited by archdrew (2011-01-22 18:19:16)

Offline

#2 2011-01-24 08:48:30

SolarShado
Member
Registered: 2011-01-24
Posts: 14

Re: SDL can't find _main

Haven't tried Eclipse for C/C++, but I in my limited tinkering with SDL I haven't needed to mention "SDLmain" to the compiler, just "SDL".

(PS: No need to mention the version of the ISO you installed from, since Arch is rolling-release.)

Offline

Board footer

Powered by FluxBB