我正在使用C ++和OpenGL开始一个新项目来制作一个简单的游戏并自学OpenGL。我不想使用GLUT,而宁愿使用SDL制作窗户等。但是,我在Makefile上遇到了很多奇怪的麻烦。目前,当我输入make时,当我在我的G ++命令中包含final WebClient webClient = new WebClient(BrowserVersion.CHROME);
HtmlPage page = webClient.getPage("http://www.qatarsale.com/EnMain.aspx");
HtmlAnchor anchor = page.getAnchorByText("2");
HtmlPage newPage = anchor.click();
HtmlElement el = newPage.getBody();
System.out.println(el.asText());
时,我得到了这个响应:
$(LFLAGS) $(LDFLAGS)
当我不这样做时这个回应:
g++-5 tetris.o -o tetris -std=c++14
Undefined symbols for architecture x86_64:
"_SDL_CreateWindow", referenced from:
_main in tetris.o
"_SDL_GL_CreateContext", referenced from:
_main in tetris.o
"_SDL_Init", referenced from:
_main in tetris.o
"_SDL_PollEvent", referenced from:
game_loop(SDL_Window*) in tetris.o
"_glewGetErrorString", referenced from:
_main in tetris.o
"_glewInit", referenced from:
_main in tetris.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make: *** [tetris] Error 1
这是我的新Makefile:
g++-5 -Wall -framework SDL2 tetris.o -o tetris -std=c++14
ld: framework not found SDL2
collect2: error: ld returned 1 exit status
make: *** [tetris] Error 1
我的.cpp文件的标题部分:
CC = g++-5
CFLAGS = -Wall -c -Wno-deprecated-declarations
LFLAGS = -Wall
LDFLAGS = -framework SDL2
LDLIBS= -lSDL2 -lglew -lGL
INCLUDES = -I/Library/Frameworks/SDL2.framework/Headers/
STD = -std=c++14
all: tetris
tetris: tetris.o
$(CC) $(LFLAGS) $(LDFLAGS) tetris.o -o tetris $(STD)
tetris.o: tetris.cpp
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ tetris.cpp $(STD)
.PHONY: clean
clean:
rm tetris *.o
答案 0 :(得分:3)
也许你需要添加
LDFLAGS = -framework GLUT
到你的Makefile
答案 1 :(得分:0)
只需使用freeglut,您就不需要使用SDL,以便开始使用OpenGL。