2

我尝试编译以下代码(来自 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 ==========
4

3 回答 3

2

您项目的右下角

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

用“CONSOLE(/SUBSYSTEM:CONSOLE)”改变你的子系统

像这样https://www.dropbox.com/s/li3qnzw152snizo/ogre.png

于 2013-12-21T14:01:09.443 回答
2

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

INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
于 2012-08-01T05:36:30.030 回答
0

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

于 2012-05-31T19:21:03.070 回答