Symbol not found: _SDL_main

Started by
6 comments, last by CyberMike 11 years, 2 months ago

Hi

on OSX with -arch i386 all is fine but with x86_64 I get the above runtime error.

What do I need to change for 64bit?

Many thanks

Michael

Advertisement

What is your main() signature? Are you #including "SDL.h" in the file that defines main()?

Main? It's a x-plane plugin hence only plugin start etc. And yes SDL.h is included. Weird that 32bit plugin works but not 64bit. The forum: forums.libsdl.org is closed? I cannot post only log in.

Ok you mentioned none of that in your original post.

I'm not sure SDL supports being loaded in a plug-in. It expects to be the entry point on some systems. You might have just been lucky that it worked in your original configuration at all. You may be able to make it work, but you might have to modify SDL to do so.

SDL performs some truly idiotic magic to make sure that you can call your main function "main()" even on platforms where it needs to be called something else (i.e. using WinMain instead on Windows). They accomplish this by having a #define main SDL_main in their header file, which allows them to transparently preempt your main function and insert their own...

Long story short, you can't use SDL from a plugin without deleting that #define from their header files.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Below as it works in 32bit. Swiftcoder, so I should simply delete all: #define main SDL_main

that I find within sdl headers? I'll try that right now.

Many thanks

--------

Invoking: MacOS X C++ Linker

g++ -arch i386 -L/usr/local/lib -L/usr/X11R6/lib -framework OpenGL
-framework Cocoa -framework OpenAL -framework SDL -framework SDL_image
/Users/mike/workspace/P2/SDLMain.m -undefined warning -flat_namespace
-isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5
-dynamiclib -o "mac.xpl" ./main.o -lgl -lglu

ld: warning: in
/Developer/SDKs/MacOSX10.5.sdk/Library/Frameworks//OpenAL.framework/OpenAL,
file was built for ppc which is not the architecture being linked
(i386)

Finished building target: mac.xpl

You'd better also not compile SDLmain.m in with your project, or you will have conflicting definitions of main()...

Why do you want to use SDL in a plugin, again?

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Great swiftcoder, that helped.

I use SDL mainly for texture and sound loading.

Regards

Michael

This topic is closed to new replies.

Advertisement