2

I tried compiling the following code (From Ogre3d Beginner's Guide By Felix Kerger book)

#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;
}

So the compiled Process didn't work. I am currently using Visual Studio 2010 and OgreSDK_vc10_v1-7-3.

The errors are

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 ==========
Karan Pant
  • 21
  • 1
  • 2
  • Check the second answer on this question: http://stackoverflow.com/questions/6626397/error-lnk2019-unresolved-external-symbol-winmain16-referenced-in-function – gcochard May 05 '12 at 17:17

3 Answers3

2

Replace the signature of your main function to the following:

INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
nosferat
  • 933
  • 13
  • 30
2

right bottom on your project

->property linker->subsystem

change your subsystem with "CONSOLE(/SUBSYSTEM:CONSOLE)"

like this https://www.dropbox.com/s/li3qnzw152snizo/ogre.png

user3094631
  • 425
  • 3
  • 13
0

Your compiler thinks the program is a windows application but your source code is for a command line application.

Jay
  • 13,803
  • 4
  • 42
  • 69