将 premake 与函数“UseLibs”一起使用时出错带有OpenGL SDK
我正在使用 premake 来使用 OpenGL sdk 创建新项目。我正在尝试组装我的第一个真正的项目,但是当我运行 premake4 vs2010 命令时出现错误。我正在尝试使用 UseLibs 函数来访问 OpenGL sdk 元素,但是 premake 抛出一个错误,其中显示:
“尝试调用全局‘UseLibs’(零值)
这是lua代码:
solution "OpenGL"
configurations {"windows", "linux", "Debug", "Release"}
project "MyProject"
kind "ConsoleApp"
language "c++"
files {"First OpenGL v3\*.cpp", "First OpenGL v3\*.h"}
UseLibs {"glimage", "glload", "freeglut", "glutil", "glmesh", "glfw", "glm"}
configuration "windows"
defines "WIN32"
links {"glu32", "opengl32", "gdi32", "winmm", "user32"}
configuration "linux"
links {"GL"}
configuration "Debug"
targetsuffix "D"
defines "_DEBUG"
flags "Symbols"
configuration "Release"
defines "NDEBUG"
flags {"OptimizeSpeed", "NoFramePointer", "ExtraWarnings", "NoEditAndContinue"};
这里的大部分代码都是基于它在tutorial 所以我不确定为什么会收到此错误。我对此还很陌生,所以如果您发现任何其他问题,请告诉我。谢谢。
I am using premake to make new projects using the OpenGL sdk. I am trying to put together my first real project, but I am having an error when I run premake4 vs2010 command. I am trying to use the UseLibs function to gain access the the OpenGL sdk elements, however premake is throwing an error which says:
"attempt to call global 'UseLibs' (a nil value)
Heres the lua code:
solution "OpenGL"
configurations {"windows", "linux", "Debug", "Release"}
project "MyProject"
kind "ConsoleApp"
language "c++"
files {"First OpenGL v3\*.cpp", "First OpenGL v3\*.h"}
UseLibs {"glimage", "glload", "freeglut", "glutil", "glmesh", "glfw", "glm"}
configuration "windows"
defines "WIN32"
links {"glu32", "opengl32", "gdi32", "winmm", "user32"}
configuration "linux"
links {"GL"}
configuration "Debug"
targetsuffix "D"
defines "_DEBUG"
flags "Symbols"
configuration "Release"
defines "NDEBUG"
flags {"OptimizeSpeed", "NoFramePointer", "ExtraWarnings", "NoEditAndContinue"};
Much of the code here is based on what it says to do on the tutorial so I am not sure why I am getting this error. I am fairly new at this, so if you see any other issues please tell me. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请允许我引用您链接到的内容:
我在 Premake4 构建脚本中没有看到该行。
另外,没有必要同时包含 FreeGLUT 和 GLFW。您不可能在同一个应用程序中使用它们,因为它们都执行相同的操作。他们创建 OpenGL 窗口。我的意思是,我猜你可能会同时使用它们,但似乎不太可能起作用。
您的程序使用其中之一。无论它使用哪一个,您都应该将其放入
UseLibs
命令中。另外:
windows
和linux
不是正常的、用户指定的配置。 它们是操作系统配置。您没有将它们列在解决方案配置列表中;他们是系统的一部分。在这里列出它们可能会引起问题。Allow me to quote from what you linked to:
I don't see that line in your Premake4 build script.
Also, there's no need to include both FreeGLUT and GLFW. You cannot possibly use them both in the same application, since they both do the same thing. They create OpenGL windows. I mean, I guess you could possibly use them both, but it seems unlikely to work.
Your program uses one or the other. Whichever one it uses is the one you should put in the
UseLibs
command.Also:
windows
andlinux
are not normal, user-specified, configurations. They're OS configurations. You don't list them in the solution configuration's list; they're part of the system. Listing them here may cause problems.