Author Topic: Weird SDL error when running from codeblocks (from outside works)  (Read 4051 times)

Offline faragoszek

  • Single posting newcomer
  • *
  • Posts: 3
hello everyone.

here is a very simple example: http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=01 (bottom of page, Linux/SDL code).
created console application, set build options correctly, the program exits with:

Video mode set failed: Couldn't find matching GLX visual

when run from inside codeblocks with F9.

when i navigate to the bin/debug folder and run it from terminal or konqueror, it runs, and no error.

it must be something related to codeblocks, maybe i should build it with xwgtk instead of wxwidgets or something?

please help if you can, i have to start working on something and it will be annoying to switch to outside application just to run it.

thank you

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Weird SDL error when running from codeblocks (from outside works)
« Reply #1 on: December 23, 2009, 05:15:39 pm »
it must be something related to codeblocks, maybe i should build it with xwgtk instead of wxwidgets or something?

No it's definitely not related to C::B !!
Code::Blocks is an IDE, not a compiler or a framework or anything like this.

If it does not work, it is most likely a configuration error.

I just dowloaded the example, created the sdl-sample with the wizard, replaced the original file with the one coming with the example and added GL and GLU to the link-libs (after having a look into the makefile).

I get a black-screen, that can be switched to fullscreen with F1 and an output of the framerate on the console, when running as console-program (otherwise I don't see the output).

That means everything works as I expected.

Offline faragoszek

  • Single posting newcomer
  • *
  • Posts: 3
Re: Weird SDL error when running from codeblocks (from outside works)
« Reply #2 on: December 24, 2009, 11:29:06 am »
did exactly the same as you new cosole application->C->copied the example file over->set other linker options to `sdl-config --cflags --libs` and libraries to GL and GLU, same again.
even checked out latest source from svn and rebuilt
the error is still there

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Weird SDL error when running from codeblocks (from outside works)
« Reply #3 on: December 24, 2009, 11:52:06 am »
That's not he same !!
I used the SDL-wizard as base.

You have to split the sdl-config instruction.
with --cflags in the Other settings of the projects Compiler options and with --libs int the projects Linker settings tab Other linker options.

Offline faragoszek

  • Single posting newcomer
  • *
  • Posts: 3
Re: Weird SDL error when running from codeblocks (from outside works)
« Reply #4 on: December 24, 2009, 12:08:13 pm »
ok this is how i got it working:

new project with SDL wizard->add GL and GLU to links, copied over the source, changed to include with < > instead of " " of the SDL header.
no change

then i removed both `sdl-config --cflags` and `sdl-config --libs` and added SDL in link libraries, removed the include GL/GL and /GLU and added only SDL/SDL_opengl.h
now it works

weird thing is that the basic sdl wizard creates a project that works, but it does not use opengl