在Windows上为glut 3.7构建静态库 [英] Building a static library for glut 3.7 on Windows

查看:121
本文介绍了在Windows上为glut 3.7构建静态库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试将glut编译为静态库,而不必在运行时链接glut32.dll.我下载了glut Windows源代码,但是当我尝试编译时(默认),我一直在获取:

I've been trying to compile glut as a static library without having to link with glut32.dll on runtime. I downloaded the glut windows source code but when I try to compile (default), I keep getting:

Making in glut subdirectory...
        link  /INCREMENTAL:NO /NOLOGO -entry:_DllMainCRTStartup@12 -dll  -out:glut32.dll -def:glut.def glut_8x13.obj glut_9x15.obj glut_bitmap.obj glut_bwidth.obj glut_cindex.obj glut_cmap.obj glut_cu
rsor.obj glut_dials.obj glut_dstr.obj glut_event.obj glut_ext.obj glut_fullscrn.obj glut_gamemode.obj glut_get.obj glut_hel10.obj glut_hel12.obj glut_hel18.obj glut_init.obj glut_input.obj glut_joy.ob
j glut_key.obj glut_keyctrl.obj glut_keyup.obj glut_mesa.obj glut_modifier.obj glut_mroman.obj glut_overlay.obj glut_roman.obj glut_shapes.obj glut_space.obj glut_stroke.obj glut_swap.obj glut_swidth.
obj glut_tablet.obj glut_teapot.obj glut_tr10.obj glut_tr24.obj glut_util.obj glut_vidresize.obj glut_warp.obj glut_win.obj glut_winmisc.obj win32_glx.obj win32_menu.obj win32_util.obj win32_winproc.o
bj win32_x11.obj opengl32.lib glu32.lib winmm.lib kernel32.lib  ws2_32.lib mswsock.lib advapi32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib
LINK : fatal error LNK1104: cannot open file 'glut32.lib'
NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\link.EXE"' : return code '0x450'
Stop.
NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\nmake.EXE"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\nmake.EXE"' : return code '0x2'
Stop.

据我了解,应该在{source} \ lib \ glut \中编译并创建glut32.lib,但它不存在.

From what I understand, glut32.lib should be compiled and created in {source}\lib\glut\ but it's not there.

任何有助于编译静态过剩库的帮助将不胜感激.

Any help compiling a static library for glut would be appreciated.

Makefile.win

已更改:
$(link) $(LFLAGS) -out:$(GLUTDLL) -def:glut.def $(OBJS) $(LIBS)

lib $(OBJS) $(LIBS)

它生成\ lib \ glut \ glut_8x13.lib并不确定8x13是什么,但是当我尝试与之链接时,我得到了一些未解决的外部因素:

It generated \lib\glut\glut_8x13.lib not sure what the 8x13 is about but when I tried to link with it, I got some unresolved externals:

GPURenderer_test.obj : error LNK2019: unresolved external symbol __imp__glutCreateWindow@4 referenced in function "protected: __thiscall GlobalDecl::OpenGLConte
xt::OpenGLContext(unsigned int,unsigned int)" (??0OpenGLContext@GlobalDecl@@IAE@II@Z)
GPURenderer_test.obj : error LNK2019: unresolved external symbol __imp__glutInitWindowSize@8 referenced in function "protected: __thiscall GlobalDecl::OpenGLCon
text::OpenGLContext(unsigned int,unsigned int)" (??0OpenGLContext@GlobalDecl@@IAE@II@Z)
GPURenderer_test.obj : error LNK2019: unresolved external symbol __imp__glutInitWindowPosition@8 referenced in function "protected: __thiscall GlobalDecl::OpenG
LContext::OpenGLContext(unsigned int,unsigned int)" (??0OpenGLContext@GlobalDecl@@IAE@II@Z)
GPURenderer_test.obj : error LNK2019: unresolved external symbol __imp__glutInitDisplayMode@4 referenced in function "protected: __thiscall GlobalDecl::OpenGLCo
ntext::OpenGLContext(unsigned int,unsigned int)" (??0OpenGLContext@GlobalDecl@@IAE@II@Z)
GPURenderer_test.obj : error LNK2019: unresolved external symbol __imp__glutInit@8 referenced in function "protected: __thiscall GlobalDecl::OpenGLContext::Open
GLContext(unsigned int,unsigned int)" (??0OpenGLContext@GlobalDecl@@IAE@II@Z)
GPURenderer_test.obj : error LNK2019: unresolved external symbol __imp__glutSwapBuffers@0 referenced in function "protected: void __thiscall GlobalDecl::OpenGLC
ontext::_executeTest(class GlobalDecl::UnitTest &)" (?_executeTest@OpenGLContext@GlobalDecl@@IAEXAAVUnitTest@2@@Z)

谢谢, 瑞安

推荐答案

在我看来,您的构建设置中有一些非常糟糕的东西(或者您完全使用了错误的构建设置,例如尝试构建在构建它们使用的库之前,请先提供一些示例.

It looks to me like you have something pretty badly munged up in your build setup (or you're using the wrong build setup completely, such as trying to build some samples before you've built the library they use).

要构建静态库,根本不应该运行link.对于静态库,您可以编译目标文件,然后使用lib将它们放到一个库中.您将使用link来构建动态库(DLL)或可执行文件,而不是静态库.

To build a static library, you shouldn't be running link at all. For a static library, you compile your object files, then use lib to put them together into a library. You'd use link to build a dynamic library (DLL) or an executable, but not a static library.

这篇关于在Windows上为glut 3.7构建静态库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆