kdevelop - KDevelop4 linking to external library -


i'm trying setup kdevelop gcc, can't link external libraries. following error:

/home/tahsin/projects/glwrap/build> make linking cxx executable glwrap cmakefiles/glwrap.dir/main.cpp.o: in function `main': /home/_/projects/glwrap/main.cpp:11: undefined reference `glutinit' collect2: error: ld returned 1 exit status make[2]: *** [glwrap] error 1 make[1]: *** [cmakefiles/glwrap.dir/all] error 2 make: *** [all] error 2 *** failed *** 

my code simple opengl file:

#include <gl/gl.h> #include <gl/glu.h> #include <gl/glut.h> #include <cassert>  using namespace std;  int main(int argc, char **argv)  {     glutinit(&argc, argv); } 

i can of course compile file fine command line makefile, not kdevelop. i've tried setting cmakelist (although i'm new this, use makefiles). cmakelist associated kdev project looks this:

cmake_minimum_required(version 2.8) project(glwrap) set(cmake_cxx_flags "-lglut -lglu -lgl -i/path/to/the/include/dir") include_directories( /usr/include ) include_directories( /usr/lib ) include_directories( /usr/include ) link_directories( /usr/lib64 ) link_directories( /usr/lib32 )  add_executable(glwrap main.cpp) install(targets glwrap runtime destination bin) 

is there specific needs set gui?

i'm not cmake expert, believe problem cmake needs in finding glut includes. 2 solutions might work are:

  1. find them , insert additional explicit include_directories( ) commands in cmakelist file program.
  2. (this uses powerful feature of cmake system.) use cmake findglut command. (check cmake documentation findxxx usage.) cmake glut files you.

in either case, after inserting changes cmakelist file, should run configure command in kdevelop4 project menu. cmake execute cmakelist changes , report if glut files found.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -