[SDL] Loving SDL, but having trouble with multiple definitions of
Sam Crow
samuraileumas at yahoo.com
Mon Mar 19 12:53:54 PDT 2007
<A.L.Moore> writes:
>
> I am very much enjoying using SDL in my work and am finding it to be just as
> simple as the name promises. Except for one thing: compile errors related
> to "main" (or "mainwin"). They've already tripped up my attempt to get SDL
> working with the Borland commandline tools (MSVC++ works fine), but this time
> I can't dodge the problem.
>
> distro: PCLinuxOS (great for people venturing out from Windows)
>
> compiler: GCC, run in Konsole
>
> error message:
> /usr/lib/gcc/i586-mandriva-linux-gnu/4.1.1/../../../crt1.o: In function
> `_start':
> (.text+0x18): undefined reference to `main'
> collect2: ld returned 1 exit status
>
> Ladies and gents, what am I doing wrong? If you need more information, please
> let me know!
>
Are you aware of the fact that SDL defines a macro to wrap the main function?
It expects int main(argc, *argv[]) as its arguments (with the possible exception
of using different variable names for the passed parameters). If you try int
main() or int main(void) or void main() or anything that doesn't include the
arguments passed from the command line, it won't work.
Also, as an unrelated hint for future problems with Linux is that Linux uses
case-sensitive filenames so #include <SDL/SDL.h> will work if you have your
headers in the SDL directory using captial letters. If you use lowercase it
won't work.
More information about the SDL
mailing list