KDevelop を Gcc でセットアップしようとしていますが、外部ライブラリに正しくリンクできません。次のエラーが表示されます。
/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 ***
私のコードは単純なopenglファイルです:
#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);
}
もちろん、コマンドラインの Makefile からファイルをうまくコンパイルできますが、kDevelop からはコンパイルできません。私は CMakeList を設定しようとしました (私はこれが初めてですが、通常は Makefile を使用します)。kDev プロジェクトに関連付けられた CMakeList は次のようになります。
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)
GUI から設定する必要がある特定のものはありますか?