[SDL] Undefined reference to SDL_main

Leo M. Cabrera leo28c at gmail.com
Sat Jan 19 20:54:55 PST 2008


Try renaming appending the .exe extension to sdl-config... worked for me. :P

KHMan wrote:
> Tim Rau wrote:
>   
>> KHMan <keinhong <at> gmail.com> writes:
>>     
>>>> [snip snip]
>>>>         
>> [snip snip]
>>
>> I got SDL 1.2.13, and It doesn't seem to have a windows binary for sdl-config. I
>> found the linux one in bin(It ran alright on my other(linux) system) Is there
>> some other thing that goes on for windows?
>>     
>
> I usually am too lazy to build from sources, so I always grab the
> mingw developer library version. If installed according to
> instructions, you should be able to run sdl-config in your bash
> shell; it's a shell script. In the SDL sources, sdl-config is
> generated from sdl-config.in. Try searching your msys directory
> tree and see if you can find it; it should be in there somewhere.
>
>   
>>> [snip snip]
>>> # Makefile
>>>
>>> CPPFLAGS = $(shell sdl-config --cflags)
>>> LDFLAGS = $(shell sdl-config --libs) -lm
>>>
>>> APPNAME = try
>>> EXT = .exe
>>>
>>> all: $(APPNAME)
>>>
>>> $(APPNAME): $(APPNAME).cpp
>>>
>>> clean:
>>> 	rm -f $(APPNAME)$(EXT)
>>>
>>> .PHONY: all
>>>       
>
> Ought to be ".PHONY: all clean" and testing for OS/OSTYPE will
> probably help with appending .exe automatically... (the more
> popular scheme is to separate out these things and put them in a
> separate config file, see tcc's Makefile for example) the suffix
> is always a little troublesome for portable Makefiles. Using
> $(APPNAME)$(EXT) might be better... I dunno what is better. If you
> have a bunch of source files, then it is usually something like:
>
> OBJS = foo.o \
>        bar.o
>
> $(APPNAME)$(EXT): $(OBJS)
>
> # dependencies here, or generate automatically and add an
> # include statement
> foo.cpp: foo.h
> bar.cpp: bar.h foo.h
>
> And I believe the implicit rules should be able to handle
> everything else. Something like that. A few simple Makefile
> examples in the SDL wiki ought to be helpful.
>
>   



More information about the SDL mailing list