Author Topic: SDL compile trouble  (Read 3184 times)

Fromwithin

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
    • http://fromwithin.com/
SDL compile trouble
« on: May 31, 2004, 10:47:02 am »
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

  • Jr. Member
  • **
  • Posts: 90
    • View Profile
    • http://
SDL compile trouble
« Reply #1 on: June 10, 2004, 04:53:41 pm »
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

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
    • http://fromwithin.com/
SDL compile trouble
« Reply #2 on: June 11, 2004, 07:08:31 am »
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

  • Full Member
  • ***
  • Posts: 114
    • View Profile
    • http://zports.sf.net
SDL compile trouble
« Reply #3 on: June 11, 2004, 07:50:37 am »
You can also put SDL_main() in your code instead of main(), I believe that usually work
(Or maybe you have to).
Zaurus Porting Project :
http://zports.sf.net
Conics:
http://www.conics.net

blakeyez

  • Jr. Member
  • **
  • Posts: 90
    • View Profile
    • http://
SDL compile trouble
« Reply #4 on: June 12, 2004, 10:38:17 am »
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