2011-02-05 4 views
1

私はFLTKを見つけたばかりで、テストのためにmakefileを作った。 GLUにリンクするにはどうすればいいですか?

 
In file included from MyWindow.cpp:10: 
MyWindow.h:14:20: error: GL/glu.h: No such file or directory 
MyWindow.cpp: In member function ‘virtual void MyWindow::draw()’: 
MyWindow.cpp:49: error: ‘gluPerspective’ was not declared in this scope 
make: * [MyWindow.o] Error 1 
(コードは無関係です)コンパイラがあなたの GLU.hヘッダを見つけることができません

答えて

0


################ template makefile ############## 
# We don't know what compiler to use to build fltk on this machine - but fltk-config does... 
CC  = $(shell fltk-config --cc) 
CXX = $(shell fltk-config --cxx) 

# Set the flags for compiler: fltk-config knows the basic settings, then we can add our own... 
CFLAGS   = $(shell fltk-config --cflags) 
CXXFLAGS = $(shell fltk-config --cxxflags) -I/System/Library/Frameworks/OpenGL.framework/Versions/A/ 

# We don't know what libraries to link with: fltk-config does... 
LINKFLTK = $(shell fltk-config --ldstaticflags) 
LINKFLTK_GL = $(shell fltk-config --use-gl --ldstaticflags) -lGLU 
LINKFLTK_IMG = $(shell fltk-config --use-images --ldstaticflags) 

# Possible steps to run after linking... 
STRIP      = strip 
POSTBUILD  = fltk-config --post # Required on OSX, does nothing on other platforms, so safe to call 
TARGET  = CompletedFile 

# Define what your target application is called 
all: $(TARGET) 

# Define how to build the various object files... -snip- 

# Now define how to link the final app - let's assume it needs image and OpenGL support 
$(TARGET): MyWindow.o main.o 
     $(CXX) -o [email protected] MyWindow.o main.o $(LINKFLTK_IMG) $(LINKFLTK_GL) 
     $(STRIP) [email protected] 
     $(POSTBUILD) [email protected]  # only required on OSX, but call it anyway for portability 

############### end ################# 

(相続人は、オブジェクトファイルコード:)ここ

main.o: main.cpp MyWindow.h main.h 
     $(CXX) -c $< \ 
      $(CXXFLAGS)

MyWindow.o: MyWindow.cpp MyWindow.h $(CXX) -c $< \ $(CXXFLAGS)

が、それは私を与えるエラーがある:ここに私のメイクファイルであります。適切な場所を指すように #includeまたは -I switchを調整します。

0

使用しているfltkのバージョンによっては、独自のOpenGLヘッダーがあります。私はインクルードライブラリに次の行を追加します: -lfltk -lfltk_gl -lGL -lGLU

残念ですが、それは仕事を終わらせます。

+0

なぜ「過剰」ですか?より深刻なプロジェクトでは、数多くの共有ライブラリが使用されています...代替GUIツールキットに基づいてアプリケーションをチェックします。 – DejanLekic

関連する問題