【问题标题】:unresolved external symbol _WinMain@16未解析的外部符号 _WinMain@16
【发布时间】:2012-05-05 17:14:06
【问题描述】:

我尝试编译以下代码(来自 Felix Kerger 的 Ogre3d 初学者指南)

#include "Ogre\ExampleApplication.h"    

class Example1 : public ExampleApplication
{
public:
void createScene()
{Ogre::Entity* ent =
mSceneMgr->createEntity("MyEntity","Sinbad.mesh");
mSceneMgr->getRootSceneNode()->attachObject(ent);
}
};



int main (void)
{
Example1 app;
app.go();
return 0;
}

所以编译的进程没有工作。我目前正在使用 Visual Studio 2010 和 OgreSDK_vc10_v1-7-3。

错误是

1>InitializeBuildStatus:
1>  Touching "obj\Debug\OgreApp3.unsuccessfulbuild".
1>ClCompile:
1>  main.cpp
1>d:\ogresdk_vc10_v1-7-3\include\ogre\exampleframelistener.h(343): warning C4244: '+=': conversion from 'double' to 'Ogre::Real', possible loss of data 
1>d:\ogresdk_vc10_v1-7-3\include\ogre\exampleframelistener.h(344): warning C4244: '-=' : conversion from 'double' to 'Ogre::Real', possible loss of data
1>d:\ogresdk_vc10_v1-7-3\include\ogre\exampleframelistener.h(348): warning C4244: 'argument' : conversion from 'double' to 'Ogre::Real', possible loss of data
1>d:\ogresdk_vc10_v1-7-3\include\ogre\exampleframelistener.h(349): warning C4244: 'argument' : conversion from 'double' to 'Ogre::Real', possible loss of data
1>d:\ogresdk_vc10_v1-7-3\include\ogre\exampleframelistener.h(454): warning C4244: '-=' : conversion from 'double' to 'Ogre::Real', possible loss of data
1>ManifestResourceCompile:
1>  All outputs are up-to-date.
1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
1>bin\Debug\\OgreApp3.exe : fatal error LNK1120: 1 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:10.57
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

【问题讨论】:

标签: ogre


【解决方案1】:

将 main 函数的签名替换为以下内容:

INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )

【讨论】:

    【解决方案2】:

    项目的右下角

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

    使用“CONSOLE(/SUBSYSTEM:CONSOLE)”更改您的子系统

    喜欢这个https://www.dropbox.com/s/li3qnzw152snizo/ogre.png

    【讨论】:

      【解决方案3】:

      您的编译器认为该程序是一个 Windows 应用程序,但您的源代码是一个命令行应用程序。

      【讨论】:

        猜你喜欢
        • 2021-04-18
        • 2014-02-03
        • 1970-01-01
        • 1970-01-01
        • 2011-02-09
        相关资源
        最近更新 更多