+ -
当前位置:首页 → 问答吧 → 一个比较基础的问题,但由于我是新手,所以不会,

一个比较基础的问题,但由于我是新手,所以不会,

时间:2011-12-13

来源:互联网

创建了一个WIN32的空项目,然后按照教程新建了个SampleApp.cpp,代码也写进去了,并且编译成功了
1>------ Rebuild All started: Project: Test1, Configuration: Debug Win32 ------
1>Build started 2011/12/13 16:29:12.
1>_PrepareForClean:
1> Deleting file "Debug\Test1.lastbuildstate".
1>InitializeBuildStatus:
1> Creating "Debug\Test1.unsuccessfulbuild" because "AlwaysCreate" was specified.
1>ClCompile:
1> SampleApp.cpp
1>e:\opengl\ogresdk_vc10_v1-7-3\include\ogre\exampleframelistener.h(343): warning C4244: '+=' : conversion from 'double' to 'Ogre::Real', possible loss of data
1>e:\opengl\ogresdk_vc10_v1-7-3\include\ogre\exampleframelistener.h(344): warning C4244: '-=' : conversion from 'double' to 'Ogre::Real', possible loss of data
1>e:\opengl\ogresdk_vc10_v1-7-3\include\ogre\exampleframelistener.h(348): warning C4244: 'argument' : conversion from 'double' to 'Ogre::Real', possible loss of data
1>e:\opengl\ogresdk_vc10_v1-7-3\include\ogre\exampleframelistener.h(349): warning C4244: 'argument' : conversion from 'double' to 'Ogre::Real', possible loss of data
1>e:\opengl\ogresdk_vc10_v1-7-3\include\ogre\exampleframelistener.h(454): warning C4244: '-=' : conversion from 'double' to 'Ogre::Real', possible loss of data
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(990,5): warning MSB8012: TargetPath(E:\OPENGL\GameDevelop\Test1\Debug\Test1.exe) does not match the Linker's OutputFile property value (E:\OPENGL\GameDevelop\Test1\bin\Debug\Test1.exe). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile).
1>Manifest:
1> Deleting file "Debug\Test1.exe.embed.manifest".
1>LinkEmbedManifest:
1> Test1.vcxproj -> E:\OPENGL\GameDevelop\Test1\Debug\Test1.exe
1>FinalizeBuildStatus:
1> Deleting file "Debug\Test1.unsuccessfulbuild".
1> Touching "Debug\Test1.lastbuildstate".
1>
1>Build succeeded.
1>
1>Time Elapsed 00:00:15.52
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

但是我点运行,却报错了....


请问怎么解决呢?

作者: kalso4212h2o   发布时间: 2011-12-13

那就是你代码有问题,编译通过了不代表程序没有问题了,编译只是停留在语法级别的,执行出错需要自己检查自己的代码看哪里出错了,可以单步调试一下。

作者: xxcc309   发布时间: 2011-12-13

图挂了,看调用堆栈执行到哪里了

作者: dahaiI0   发布时间: 2011-12-13

1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(990,5): warning MSB8012: TargetPath(E:\OPENGL\GameDevelop\Test1\Debug\Test1.exe) does not match the Linker's OutputFile property value (E:\OPENGL\GameDevelop\Test1\bin\Debug\Test1.exe). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile).

把TargetPath和OutputFile两者设成一样

作者: ouyh12345   发布时间: 2011-12-13

#include "ExampleApplication.h"

class TutorialApplication : public ExampleApplication
{
protected:
public:
  TutorialApplication()
  {
  }

  ~TutorialApplication() 
  {
  }
protected:
  void createScene(void)//今天后面的代码都是添加在这个函数中的。
  {
mSceneMgr->setAmbientLight(ColourValue(1,1,1));//为了能看清楚我们将要做的事情,首先要设置场景的光线。
Entity *ent1 = mSceneMgr->createEntity("Robot","robot.mesh");//然后创建一个物体。
SceneNode *node1 = mSceneMgr->getRootSceneNode()->createChildSceneNode("RobotNode");//对了,还要有与之关联的SceneNode。
node1->attachObject(ent1);//最后,把它们关联在一起。
//好了,就是它了!编译运行你的程序,你会看到一个机器人站在屏幕上。如果你想了解这几个函数的具体用法请查看"OGRE API Reference",你可以在开始菜单中找到,作用相当于OGRE的MSDN。
  }
};

#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
#define WIN32_LEAN_AND_MEAN
#include "windows.h"

INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
#else
int main(int argc, char **argv)
#endif
{
  // Create application object
  TutorialApplication app;

  try {
  app.go();
  } catch( Exception& e ) {
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 
  MessageBoxA( NULL, e.getFullDescription().c_str(), "An exception has occurred!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
#else
  fprintf(stderr, "An exception has occurred: %s ",
  e.getFullDescription().c_str());
#endif
  }

  return 0;

}


代码就这个,没其他了,教程说这样运行起来就会有一个机器人在里面的。
http://www.cppblog.com/keigoliye/archive/2009/12/26/104066.html
按照以上这个连接的教程做的。

作者: kalso4212h2o   发布时间: 2011-12-13

贴代码吧,编译信息看不出什么问题,而且你的错误图也挂了

作者: loseway   发布时间: 2011-12-13