Jump to content

  • Log In with Google      Sign In   
  • Create Account


Symbol not found: _SDL_main


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 CyberMike   Banned   -  Reputation: 120

Like
0Likes
Like

Posted 05 February 2013 - 01:23 AM

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

 

 



Sponsor:

#2 rip-off   Moderators   -  Reputation: 7641

Like
0Likes
Like

Posted 05 February 2013 - 03:46 AM

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



#3 CyberMike   Banned   -  Reputation: 120

Like
0Likes
Like

Posted 05 February 2013 - 09:47 AM

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.

Edited by CyberMike, 05 February 2013 - 09:50 AM.


#4 rip-off   Moderators   -  Reputation: 7641

Like
0Likes
Like

Posted 05 February 2013 - 09:52 AM

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.



#5 swiftcoder   Senior Moderators   -  Reputation: 9583

Like
0Likes
Like

Posted 05 February 2013 - 02:44 PM

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 - Software Engineer @Amazon - [swiftcoding]


#6 CyberMike   Banned   -  Reputation: 120

Like
0Likes
Like

Posted 06 February 2013 - 01:14 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


Edited by CyberMike, 06 February 2013 - 01:16 AM.


#7 swiftcoder   Senior Moderators   -  Reputation: 9583

Like
1Likes
Like

Posted 06 February 2013 - 06:39 AM

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 - Software Engineer @Amazon - [swiftcoding]


#8 CyberMike   Banned   -  Reputation: 120

Like
0Likes
Like

Posted 08 February 2013 - 04:00 AM

Great swiftcoder, that helped.

 

I use SDL mainly for texture and sound loading.

Regards

Michael






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS