C++ Ogre 3D错误-LNK1120:1个未解析外部
我来到了Ogre wiki上,根据教程的提示重命名了文件并替换了代码,但我遇到了以下错误:C++ Ogre 3D错误-LNK1120:1个未解析外部,c++,ogre,3d-engine,visual-studio-2010,C++,Ogre,3d Engine,Visual Studio 2010,我来到了Ogre wiki上,根据教程的提示重命名了文件并替换了代码,但我遇到了以下错误: 1>------ Build started: Project: Flight Simulator, Configuration: Debug Win32 ------ 1>BaseApplication.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' spec
1>------ Build started: Project: Flight Simulator, Configuration: Debug Win32 ------
1>BaseApplication.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification
1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
1>C:\Users\Jura\Documents\Visual Studio 2010\Projects\Flight Simulator\Debug\Flight Simulator.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
我已经在谷歌上搜索过了,但似乎没有找到答案
这是基本结构2.cpp
中的代码:
#include "BasicTutorial2.h"
//-------------------------------------------------------------------------------------
BasicTutorial2::BasicTutorial2(void)
{
}
//-------------------------------------------------------------------------------------
BasicTutorial2::~BasicTutorial2(void)
{
}
//-------------------------------------------------------------------------------------
void BasicTutorial2::createCamera(void)
{
}
//-------------------------------------------------------------------------------------
void BasicTutorial2::createViewports(void)
{
}
//-------------------------------------------------------------------------------------
void BasicTutorial2::createScene(void)
{
}
这在我的基本结构2.h
文件中:
/*
-----------------------------------------------------------------------------
Filename: BasicTutorial2.h
-----------------------------------------------------------------------------
This source file is part of the
___ __ __ _ _ _
/___\__ _ _ __ ___ / / /\ \ (_) | _(_)
// // _` | '__/ _ \ \ \/ \/ / | |/ / |
/ \_// (_| | | | __/ \ /\ /| | <| |
\___/ \__, |_| \___| \/ \/ |_|_|\_\_|
|___/
Tutorial Framework
http://www.ogre3d.org/tikiwiki/
-----------------------------------------------------------------------------
*/
#ifndef __BasicTutorial2_h_
#define __BasicTutorial2_h_
#include "BaseApplication.h"
class BasicTutorial2 : public BaseApplication
{
public:
BasicTutorial2(void);
virtual ~BasicTutorial2(void);
protected:
virtual void createScene(void);
virtual void createCamera(void);
virtual void createViewports(void);
};
#endif // #ifndef __BasicTutorial2_h_
我希望有人能给我答案。我尝试将子系统从“Windows”更改为“控制台”,但没有成功。我还尝试了其他解决方案,但也没有成功。回答:我忘了将main(win)函数添加到basicctural2.cpp中:
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
#define WIN32_LEAN_AND_MEAN
#include "windows.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
#else
int main(int argc, char *argv[])
#endif
{
// Create application object
BasicTutorial2 app;
try {
app.go();
} catch( Ogre::Exception& e ) {
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
#else
std::cerr << "An exception has occured: " <<
e.getFullDescription().c_str() << std::endl;
#endif
}
return 0;
}
#ifdef __cplusplus
}
#endif
\if OGRE\u PLATFORM==OGRE\u PLATFORM\u WIN32
#定义WIN32_精益_和_平均值
#包括“windows.h”
#恩迪夫
#ifdef_uucplusplus
外部“C”{
#恩迪夫
#如果OGRE\U平台==OGRE\U平台\U WIN32
INT WINAPI WinMain(HINSTANCE hInst,HINSTANCE,LPSTR strCmdLine,INT)
#否则
int main(int argc,char*argv[])
#恩迪夫
{
//创建应用程序对象
基本结构2应用程序;
试一试{
app.go();
}捕获(食人魔::异常与e){
#如果OGRE\U平台==OGRE\U平台\U WIN32
MessageBox(NULL,例如getFullDescription().c_str(),“发生异常!”,MB_OK | MB_ICONERROR | MB_TASKMODAL);
#否则
您的(win)主要功能在哪里?
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
#define WIN32_LEAN_AND_MEAN
#include "windows.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
#else
int main(int argc, char *argv[])
#endif
{
// Create application object
BasicTutorial2 app;
try {
app.go();
} catch( Ogre::Exception& e ) {
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
#else
std::cerr << "An exception has occured: " <<
e.getFullDescription().c_str() << std::endl;
#endif
}
return 0;
}
#ifdef __cplusplus
}
#endif
#include "BasicTutorial2.h"
//-------------------------------------------------------------------------------------
BasicTutorial2::BasicTutorial2(void)
{
}
//-------------------------------------------------------------------------------------
BasicTutorial2::~BasicTutorial2(void)
{
}
//-------------------------------------------------------------------------------------
void BasicTutorial2::createCamera(void)
{
}
//-------------------------------------------------------------------------------------
void BasicTutorial2::createViewports(void)
{
}
//-------------------------------------------------------------------------------------
void BasicTutorial2::createScene(void)
{
}
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
#define WIN32_LEAN_AND_MEAN
#include "windows.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
#else
int main(int argc, char *argv[])
#endif
{
// Create application object
BasicTutorial2 app;
try {
app.go();
} catch( Ogre::Exception& e ) {
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
#else
std::cerr << "An exception has occured: " <<
e.getFullDescription().c_str() << std::endl;
#endif
}
return 0;
}
#ifdef __cplusplus
}
#endif