I'm trying to setup KDevelop with Gcc, but I can't get it to properly link to external libraries. I get the 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 to `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 is a 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 the file fine from my command line Makefile, but not from kDevelop. I've tried setting up the CMakeList (although I'm new to this, I usually just use Makefiles). The CMakeList associated with the kDev project looks like 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 anything specific that needs to be set up from the GUI?