首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >LIBCMTD.lib(wcrt0.obj) LNK2019:函数___tmainCRTStartup未解析的外部符号freeGLUT.dll中引用的未解析外部符号_wmain

LIBCMTD.lib(wcrt0.obj) LNK2019:函数___tmainCRTStartup未解析的外部符号freeGLUT.dll中引用的未解析外部符号_wmain
EN

Stack Overflow用户
提问于 2012-06-16 20:10:31
回答 2查看 4.4K关注 0票数 0

我在VS2010中使用了一种解决方案(不是我自己的),它是使用freeGLUT开发的,这是一种开源的、扩展的替代过剩的方法(OpenGL的Utility )。该程序在发布模式下编译并运行exe,但在尝试调试时,我得到以下错误:

错误1错误LNK2019:函数___tmainCRTStartup LIBCMTD.lib(wcrt0.obj)中引用的未解析外部符号_wmain

错误2错误LNK1120: 1未解决的外部freeglut.dll自由

我下载并引用了所有库和包含文件,比如自述文件告诉我:

代码语言:javascript
复制
Installation

Create a folder on your PC which is readable by all users, for example
“C:\Program Files\Common Files\MSVC\freeglut\” on a typical Windows system. Copy
the “lib\” and “include\” folders from this zip archive to that location.

The appropriate freeglut DLL can either be placed in the same folder as your
application, or can be installed in a system-wide folder which appears in your
%PATH% environment variable. Be careful not to mix the 32 bit DLL up with the 64
bit DLL, as they are not interchangeable.


Compiling 32 bit Applications

To create a 32 bit freeglut application, create a new Win32 C++ project in MSVC.
From the “Win32 Application Wizard”, choose a “Windows application”, check the
“Empty project” box, and submit.

You’ll now need to configure the compiler and linker settings. Open up the
project properties, and select “All Configurations” (this is necessary to ensure
our changes are applied for both debug and release builds). Open up the
“general” section under “C/C++”, and configure the “include\” folder you created
above as an “Additional Include Directory”. If you have more than one GLUT
package which contains a “glut.h” file, it’s important to ensure that the
freeglut include folder appears above all other GLUT include folders.

Now open up the “general” section under “Linker”, and configure the “lib\”
folder you created above as an “Additional Library Directory”.


A freeglut
application depends on the import libraries “freeglut.lib” and “opengl32.lib”,
which can be configured under the “Input” section.


However, it shouldn’t be
necessary to explicitly state these dependencies, since the freeglut headers
handle this for you. Now open the “Advanced” section, and enter “mainCRTStartup”
as the “Entry Point” for your application. This is necessary because GLUT
applications use “main” as the application entry point, not “WinMain”—without it
you’ll get an undefined reference when you try to link your application.

That’s all of your project properties configured, so you can now add source
files to your project and build the application. If you want your application to
be compatible with GLUT, you should “#include <GL/glut.h>”. If you want to use
freeglut specific extensions, you should “#include <GL/freeglut.h>” instead.

Don’t forget to either include the freeglut DLL when distributing applications,
or provide your users with some method of obtaining it if they don’t already
have it!

下面是链接器设置截图的链接,就像我现在拥有的一样:http://imgur.com/a/SDwBv

EN

回答 2

Stack Overflow用户

发布于 2015-02-16 13:23:27

属性->链接器->系统->子系统

将Windows (/SUBSYSTEM:WINDOWS)更改为控制台(/SUBSYSTEM:CONSOLE)

票数 1
EN

Stack Overflow用户

发布于 2012-06-16 20:36:07

"wmain“是图形.exe的主要入口点。

问:您选择了"Windows应用程序“吗?

问:你是在构建一个.exe (一个完整的程序),还是仅仅是一个.dll?

链接器认为您正在尝试构建一个.exe,它需要一个“主程序”(带有“wmain()”)。

如果正在构建.dll,请将Visual的“目标”更改为.dll并“重新构建所有”。

如果您正在构建一个.exe,请找到“主模块”,并确保它包含在您的项目中。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11066681

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档