SDL configuration in the Eclipse IDE

I am trying to run OpenGL code on Eclipse in x86 Linux (ubuntu) environment:   http://nehe.gamedev.net/tutorial/vertex_buffer_objects/22002/ The code will work correctly after entering the command line using

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

What is the instruction from the make file. Now I'm trying to run the code on Eclipse, I know that I have to install the GL and GLU linker libraries and the linker library directory / usr / X 11R6 / lib /. However, regarding, sdl-config --cflags --libsI'm not sure how to configure it in Eclipse.

+5
source share
3 answers

++ (File > New > ++ Project). toolchain - Linux GCC.

++ 11, :

  • " " "".
  • (C/++ Build > > GCC ++ > )
  • " " add: -std = ++ 0x
  • "", ""

Eclipse SDL2

  • " " "".
  • (C/++ > > )
  • "" "SDL2" ""
  • "" "SDL2main" ""

, .

+3

Eclipse, sdl-config :

## Compiler flags
$ sdl-config  --cflags
-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT

## Linker flags
$ sdl-config  --libs
-L/usr/lib/x86_64-linux-gnu -lSDL
+2

. Fedora22 Eclipse Mars 4.5.1 . @Zammalad, ,

  • ++ ( > > ++).
  • toolchain - Linux GCC.

++ 11, :

  • " " .
  • (C/++ Build > > GCC ++ > )
  • " " : "ISO ++ 11 (-std = ++ 0x)". "", "" .

Eclipse SDL2

@esperanto /, / / SDL2 .

-, , "" /

$ sdl2-config --cflags

, /-

$ sdl2-config --libs

, Fedora22 (64 ) :

$ sdl2-config --cflags --libs
-I/usr/include/SDL2 -D_REENTRANT
-lSDL2 -lpthread

, eclipse - .. - :

$ mkdir /tmp/testing
$ cp -r main.cpp error.cpp lesson45.cpp /tmp/testing/.
$ cd /tmp/testing
$ g++ `sdl2-config --cflags --libs` -o lesson45 main.cpp error.cpp lesson45.cpp

, / SDL2 Eclipse, sdl2-config --libs

  • " " .
  • (C/++ > > )
  • " " SDL2 ""
  • " " pthread ""

sdl2-config --cflags

  • " " .
  • (* C/++ Build > > GCC ++ > )
  • Under Defined Characters (-D) , click the Add icon
  • Enter _REENTRANTand click OK
+1
source

All Articles