提示コードのコマンドラインですが下記のmakefileのようにライブラリを指定してもなぜリンクエラーがでるのでしょか?
pkg-config --cflags % pkg-config --libs
shigurechan@shigurechan-System-Product-Name:~/program/FrameWork$ pkg-config --cflags opengl shigurechan@shigurechan-System-Product-Name:~/program/FrameWork$ pkg-config --cflags glew shigurechan@shigurechan-System-Product-Name:~/program/FrameWork$ pkg-config --cflags glfw3 shigurechan@shigurechan-System-Product-Name:~/program/FrameWork$ pkg-config --cflags freetype2 -I/usr/local/include/freetype2 shigurechan@shigurechan-System-Product-Name:~/program/FrameWork$ pkg-config --libs opengl -lOpenGL shigurechan@shigurechan-System-Product-Name:~/program/FrameWork$ pkg-config --libs glew -lGLEW -lGLU -lGL shigurechan@shigurechan-System-Product-Name:~/program/FrameWork$ pkg-config --libs glfw3 -lglfw shigurechan@shigurechan-System-Product-Name:~/program/FrameWork$ pkg-config --libs freetype2 -L/usr/local/lib -lfreetype
を使ってパスを調べてそのまま入力したのですが原因がわかりません。
command
1PRG :=GL 2SRC_DIR :=source 3OBJ_DIR :=obj 4DEP_DIR :=obj 5DEP :=$(wildcard $(DEP_DIR)/*.d) 6SRC :=$(wildcard $(SRC_DIR)/*.cpp) 7OBJ :=$(addprefix $(OBJ_DIR)/,$(patsubst %.cpp,%.o,$(notdir $(SRC)))) 8 9 10 11$(PRG): $(OBJ) 12 #$(CXX) $^ -l ncurses -o $@ 13 $(CXX) -lGLEW -lGL -lglfw -L/usr/local/lib -lfreetype $^ -o $@ 14 15 16 17$(OBJ_DIR)/%.o: source/%.cpp 18 $(CXX) -std=c++2a -I/usr/local/include/freetype2 -c -MMD -MP $< -o $@ 19 -include $(DEP) 20 21clean: 22 rm -f ./$(OBJ_DIR)/*.o *.out ./$(OBJ_DIR)/*.d *.a $(PRG) 23
コマンドラインのログ(長すぎるの省略しています。)
g++ -lGLEW -lGL -lglfw -L/usr/local/lib -lfreetype obj/Ellipse.o obj/Line.o obj/Transform_2D.o obj/Circle.o obj/Triangle.o obj/Window.o obj/Camera.o obj/Main.o obj/Text.o obj/Init.o obj/Resource.o obj/Rectangle.o obj/Shader.o obj/Help.o obj/Point.o obj/Render.o obj/FrameWork.o obj/Simple_Draw.o -o GL /usr/bin/ld: obj/Ellipse.o: in function `FrameWork::Ellipse::Draw(glm::vec<2, float, (glm::qualifier)0>, glm::vec<2, float, (glm::qualifier)0>, int, float)': Ellipse.cpp:(.text+0x179): undefined reference to `__glewEnableVertexAttribArray' /usr/bin/ld: Ellipse.cpp:(.text+0x18a): undefined reference to `__glewBufferData' /usr/bin/ld: Ellipse.cpp:(.text+0x1f7): undefined reference to `__glewVertexAttribPointer' /usr/bin/ld: Ellipse.cpp:(.text+0x3d1): undefined reference to `__glewBufferSubData' /usr/bin/ld: Ellipse.cpp:(.text+0x6cf): undefined reference to `glDrawArrays' /usr/bin/ld: obj/Line.o: in function `FrameWork::Line::Line()': Line.cpp:(.text+0xa6): undefined reference to `__glewEnableVertexAttribArray' /usr/bin/ld: Line.cpp:(.text+0xb4): undefined reference to `__glewBufferData' /usr/bin/ld: Line.cpp:(.text+0x11b): undefined reference to `__glewVertexAttribPointer' /usr/bin/ld: obj/Line.o: in function `FrameWork::Line::Draw(glm::vec<2, float, (glm::qualifier)0>, glm::vec<2, float, (glm::qualifier)0>, unsigned short, float)': Line.cpp:(.text+0x1f5): undefined reference to `glLineWidth' /usr/bin/ld: Line.cpp:(.text+0x654): undefined reference to `__glewBufferSubData' /usr/bin/ld: Line.cpp:(.text+0x6e8): undefined reference to `glDrawArrays' /usr/bin/ld: obj/Circle.o: in function `FrameWork::Circle::Draw(glm::vec<2, float, (glm::qualifier)0>, unsigned short, unsigned short, float)': Circle.cpp:(.text+0x17b): undefined reference to `__glewEnableVe
回答1件
あなたの回答
tips
プレビュー