如何为 Windows 配置 OpenGL makefile?(从 Linux)
这是 makefile:
CC = g++
LD = g++
CFLAGS = -I/usr/X11R6/include -I. -c
LDFLAGS = -L/usr/X11R6/lib -lglut -lGLU -lGL -lXi -lXmu -lXt -lXext -lX11 -lSM -lICE -lm
INCS =
OBJS = x.o
all: x
clean:
rm -rf $(OBJS) x
cgRender.o: $(INCS) x.cpp
$(CC) $(CFLAGS) x.cpp -o x.o
cgRender: $(OBJS)
$(LD) $(OBJS) -o x $(LDFLAGS)
它是为 Linux 制作的,但我正在尝试在 Windows 上编译它。
我不断收到的错误看起来像这样:
c:/strawberry/c/bin/*directories that don't exist/i686-w64-mingw32/bin/ld.exe: cannot find -lGlu/-lGl/-lXi/etc....
如果有人可以帮助我,我将非常感激。谢谢
Here is the makefile:
CC = g++
LD = g++
CFLAGS = -I/usr/X11R6/include -I. -c
LDFLAGS = -L/usr/X11R6/lib -lglut -lGLU -lGL -lXi -lXmu -lXt -lXext -lX11 -lSM -lICE -lm
INCS =
OBJS = x.o
all: x
clean:
rm -rf $(OBJS) x
cgRender.o: $(INCS) x.cpp
$(CC) $(CFLAGS) x.cpp -o x.o
cgRender: $(OBJS)
$(LD) $(OBJS) -o x $(LDFLAGS)
Its made for Linux but I'm trying to compile it on windows.
The errors I keep getting look like this:
c:/strawberry/c/bin/*directories that don't exist/i686-w64-mingw32/bin/ld.exe: cannot find -lGlu/-lGl/-lXi/etc....
If somebody could help me out here, I'd be very appreciative. Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 Windows 中,您通常不会链接到 X11 库,因此请删除所有
-lX…
、-lSM
和-lICE
。同时删除 X11 包含和库目录参数-I/usr/X11R6/include
、-L/usr/X11R6/lib
。请注意,这个 Makefile 必须非常旧,因为这些库和目录都不需要向编译器或链接器显式提及,因为 GLUT 将库作为动态库依赖项提取。
In Windows you normaly don't link against X11 libraries, so remove all the
-lX…
,-lSM
and-lICE
. Also remove the X11 include and library directory parameters-I/usr/X11R6/include
,-L/usr/X11R6/lib
.Note that this Makefile must be really old, because neither those libraries, nor the directories should require explicit mentioning to the compiler or linker, as GLUT pulls the libraries as dynamic library dependency.