c++/opengl-project を g++ コマンドでコンパイルしようとしました。(2 つ目の自己作成プログラムを使用してすべてのターゲット システムで再コンパイルしたいので、これが必要です。)
しかし、私が実行すると:
g++ -Iinclude -Isrc $(pkg-config --cflags freetype2) -L/usr/X11R6/lib -L/usr/lib $(pkg-config --libs glew) -lglut $(pkg-config --libs glu) $(pkg-config --libs freetype2) main.cpp (some more source files) src/Vec4.cpp
gl/glu/glut/glew-functions の「未定義の参照」がたくさんあるので、ライブラリで何かが失敗すると思います。
/tmp/ccUm2dEl.o: In function `Box::render()':
Box.cpp:(.text+0x6e8): undefined reference to `glEnable'
Box.cpp:(.text+0x72c): undefined reference to `glBindTexture'
Box.cpp:(.text+0x736): undefined reference to `glBegin'
...
TextureManager.cpp:(.text+0x23b): undefined reference to `glTexParameteri'
TextureManager.cpp:(.text+0x295): undefined reference to `glTexImage2D'
collect2: ld gab 1 als Ende-Status zurück
私はいくつかの調査を行いましたが、上記のコマンドが正しいはずであることがわかりました。pkg-config-calls も確認しましたが、動作しているようです。g++ コマンドを試す前に、Codeblocks IDE を使用してコンパイルしましたが、うまくいきました。ここに私の設定があります:
コンパイラ設定 | その他のオプション:
`pkg-config --cflags freetype2`
リンカー設定|リンク ライブラリ:
glut
リンカー設定 | その他のリンカー オプション:
`pkg-config --libs glu`
`pkg-config --libs glew`
`pkg-config --libs freetype2`
検索ディレクトリ|コンパイラ:
include
src
私のシステム(Ubuntu Precise):
$ uname -a
Linux andromeda 3.2.0-32-generic #51-Ubuntu SMP Wed Sep 26 21:33:09 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
$ g++ -dumpversion
4.6
glxinfo
GLX version: 1.4
OpenGL version string: 4.2.0 NVIDIA 304.43
Codeblocks-version: 10.04
アドバイスありがとう