Help - Search - Members - Calendar
Full Version: SDL compile trouble
OESF Forums > Distros, Development, and Model Specific Forums > Everything Development > Linux Applications
Fromwithin
I can now compile fbzx, the spectrum emulator. It runs, but the screen is messed up. So that I can test the result of various SDL settings to try to fix it, I've written a tiny test SDL program that should initialize SDL, open an SDL screen, then shut down.

The test uses the same command sequence as fbzx, uses the same parameters, and links to the same libraries. But if I try to run it, I get "QPaintDevice: Must construct a QApplication before a QPaintDeivce".

I can't see why it's doing that because fbzx actually runs and opens a screen.

Anybody know what's going on?

I'm using SDL1.2.6 libraries from zports with the SDL1.2.6 SDK files from gnurou.org.
blakeyez
Hi there

I've been working on compiling stuff for my friend's Zaurus (mine's coming next week!). The problem you're experiencing means that you are not linking against SDLmain. Use -lSDLmain before -lSDL in your linking command and that should fix it.
Fromwithin
I managed to sort it out. I was previously linking with SDLMain, but there are some extra lines of code you have to put near the user main function as specified in the SDL docs.

Thanks though.
_Psycho
You can also put SDL_main() in your code instead of main(), I believe that usually work smile.gif
(Or maybe you have to).
blakeyez
You shouldn't have to put SDL_main(), since the SDLmain.a library contains a macro that will rename your main() function to SDL_main() automatically, then has its own main() function that calls SDL_main() after initialization.

Dave
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.