Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SDL configuration in Eclipse IDE

I am trying to get a OpenGL code run on Eclipse in Linux x86 environment (ubuntu): http://nehe.gamedev.net/tutorial/vertex_buffer_objects/22002/ The code would run properly after I input in the command line with

g++ main.cpp error.cpp lesson45.cpp -o lesson45 -L/usr/X11R6/lib/ -lGL -lGLU sdl-config --cflags --libs

Which is the instruction from the make file. Now I'm attempting to get the code run on Eclipse, I know I must set up linker libraries GL and GLU and linker library directory /usr/X11R6/lib/. However, with respect to sdl-config --cflags --libs, I am not sure how to configure it within Eclipse.

like image 655
SkyOasis Avatar asked Mar 22 '13 01:03

SkyOasis


1 Answers

Create a new C++ project (File > New > C++ Project). You will need to pick a toolchain - Linux GCC.

If you want to use C++11 do the following:

  1. Right click your Project under “Package Explorer” and select Properties.
  2. Select (C/C++ Build > Settings > GCC C++ Compiler > Miscellaneous)
  3. Under “Other flags” add: -std=c++0x
  4. Click Apply then OK

Configure Eclipse to use SDL2

  1. Right click your Project under “Package Explorer” and select Properties.
  2. Select (C/C++ General > Paths and Symbols > Libraries)
  3. Click “Add” and add “SDL2″ and click OK
  4. Click “Add” and add “SDL2main” and click OK

This process has been tested and confirmed working although I don't take any credit for it. Information sourced from HERE

like image 175
Zammalad Avatar answered Nov 03 '22 22:11

Zammalad