Проект здания под VS2013 работает только тогда, когда каждый *.cpp скомпилирован вручную
Я пытаюсь скомпилировать Ogre Wiki Tutorial Framework 1.9 - (Окончания строк Windows) в VisualStudio 2013. Щелкните правой кнопкой мыши по OgreFramework
проект и выбор Rebuild
возвращает следующие ошибки:
Error 487 error LNK2001: unresolved external symbol "protected: virtual void __thiscall BaseApplication::windowClosed(class Ogre::RenderWindow *)" ([email protected]@@[email protected]@@@Z) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 488 error LNK2001: unresolved external symbol "protected: virtual void __thiscall BaseApplication::windowResized(class Ogre::RenderWindow *)" ([email protected]@@[email protected]@@@Z) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 489 error LNK2001: unresolved external symbol "protected: virtual bool __thiscall BaseApplication::mouseReleased(class OIS::MouseEvent const &,enum OIS::MouseButtonID)" ([email protected]@@[email protected]@@[email protected]@@Z) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 490 error LNK2001: unresolved external symbol "protected: virtual bool __thiscall BaseApplication::mousePressed(class OIS::MouseEvent const &,enum OIS::MouseButtonID)" ([email protected]@@[email protected]@@[email protected]@@Z) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 491 error LNK2001: unresolved external symbol "protected: virtual bool __thiscall BaseApplication::mouseMoved(class OIS::MouseEvent const &)" ([email protected]@@[email protected]@@@Z) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 492 error LNK2001: unresolved external symbol "protected: virtual bool __thiscall BaseApplication::keyReleased(class OIS::KeyEvent const &)" ([email protected]@@[email protected]@@@Z) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 493 error LNK2001: unresolved external symbol "protected: virtual bool __thiscall BaseApplication::keyPressed(class OIS::KeyEvent const &)" ([email protected]@@[email protected]@@@Z) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 494 error LNK2001: unresolved external symbol "protected: virtual bool __thiscall BaseApplication::frameRenderingQueued(struct Ogre::FrameEvent const &)" ([email protected]@@[email protected]@@@Z) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 495 error LNK2001: unresolved external symbol "protected: virtual void __thiscall BaseApplication::loadResources(void)" ([email protected]@@MAEXXZ) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 496 error LNK2001: unresolved external symbol "protected: virtual void __thiscall BaseApplication::createResourceListener(void)" ([email protected]@@MAEXXZ) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 497 error LNK2001: unresolved external symbol "protected: virtual void __thiscall BaseApplication::setupResources(void)" ([email protected]@@MAEXXZ) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 498 error LNK2001: unresolved external symbol "protected: virtual void __thiscall BaseApplication::createViewports(void)" ([email protected]@@MAEXXZ) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 499 error LNK2001: unresolved external symbol "protected: virtual void __thiscall BaseApplication::destroyScene(void)" ([email protected]@@MAEXXZ) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 500 error LNK2001: unresolved external symbol "protected: virtual void __thiscall BaseApplication::createFrameListener(void)" ([email protected]@@MAEXXZ) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 501 error LNK2001: unresolved external symbol "protected: virtual void __thiscall BaseApplication::createCamera(void)" ([email protected]@@MAEXXZ) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 502 error LNK2001: unresolved external symbol "protected: virtual void __thiscall BaseApplication::chooseSceneManager(void)" ([email protected]@@MAEXXZ) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 503 error LNK2001: unresolved external symbol "protected: virtual bool __thiscall BaseApplication::configure(void)" ([email protected]@@MAE_NXZ) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 504 error LNK2001: unresolved external symbol "protected: virtual bool __thiscall BaseApplication::setup(void)" ([email protected]@@MAE_NXZ) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 505 error LNK2001: unresolved external symbol "public: virtual void __thiscall BaseApplication::go(void)" ([email protected]@@UAEXXZ) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 506 error LNK2001: unresolved external symbol "public: virtual __thiscall BaseApplication::~BaseApplication(void)" ([email protected]@[email protected]) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 507 error LNK2001: unresolved external symbol "public: __thiscall BaseApplication::BaseApplication(void)" ([email protected]@[email protected]) c:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\OgreFramework\TutorialApplication.obj OgreFramework
Error 508 error LNK1120: 21 unresolved externals C:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\Release\OgreFramework.exe OgreFramework
Но когда я это делаю, он работает:
Щелкните правой кнопкой мыши на файле BaseApplication.cpp
и выберите Compile:
1>------ Build started: Project: OgreFramework, Configuration: Release Win32 ------
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(388,5): warning MSB8028: The intermediate directory (Release\) contains files shared from another project (OgreTest.vcxproj, OgreTiny.vcxproj). This can lead to incorrect clean and rebuild behavior.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(942,5): warning MSB8027: Two or more files with the name of BaseApplication.cpp will produce outputs to the same location. This can lead to an incorrect build result. The files involved are aruco\BaseApplication.cpp, BaseApplication.cpp.
1> BaseApplication.cpp
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
Щелкните правой кнопкой мыши на файле TutorialApplication.cpp
и выберите Compile
:
1>------ Build started: Project: OgreFramework, Configuration: Release Win32 ------
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(388,5): warning MSB8028: The intermediate directory (Release\) contains files shared from another project (OgreTest.vcxproj, OgreTiny.vcxproj). This can lead to incorrect clean and rebuild behavior.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(942,5): warning MSB8027: Two or more files with the name of BaseApplication.cpp will produce outputs to the same location. This can lead to an incorrect build result. The files involved are aruco\BaseApplication.cpp, BaseApplication.cpp.
1> TutorialApplication.cpp
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
Щелкните правой кнопкой мыши по проекту OgreFramework
и выберите Build
1>------ Build started: Project: OgreFramework, Configuration: Release Win32 ------
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(388,5): warning MSB8028: The intermediate directory (Release\) contains files shared from another project (OgreTest.vcxproj, OgreTiny.vcxproj). This can lead to incorrect clean and rebuild behavior.
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(942,5): warning MSB8027: Two or more files with the name of BaseApplication.cpp will produce outputs to the same location. This can lead to an incorrect build result. The files involved are aruco\BaseApplication.cpp, BaseApplication.cpp.
1>Release\BaseApplication.obj : warning LNK4042: object specified more than once; extras ignored
1> Generating code
1> Finished generating code
1> OgreFramework.vcxproj -> C:\Users\wakatana\Documents\Visual Studio 2013\Projects\OgreFramework\Release\OgreFramework.exe
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
Оба файла *.h имеют набор Configuration Properties -> General -> Item Type
показывает: C/C++ header
Оба файла *.cpp имеют набор Configuration Properties -> General -> Item Type
показывает: C/C++ compiler
Я попытался удалить и добавить файлы *.h
в проект, как указано в этом сообщении, но у меня были такие же ошибки. Упомянутый пост также говорит, что эти ошибки можно найти в каком-то журнале, но я не могу его найти. Благодаря
EDIT:
BaseApplication.cpp or TutorialApplication.cpp -> Right click -> Properties -> Configuration Properties -> C/C++ -> Output Files -> Object File Name
показывает: $(IntDir)
OgreFramework project -> Right click -> Properties -> Configuration Properties -> C/C++ -> General -> Additional Include Directories -> <edit> -> Macros -> $(IntDir)
показывает:
Debug\
Ответы
Ответ 1
Проблема решена. Я также включил в фильтр анализатора решений, который содержал другую версию BaseApplication.cpp
и BaseApplication.cpp
(потому что я скопировал проект и не создал новый), что вызвало перезапись моих исходных BaseApplication.cpp
и BaseApplication.h
. Все кредиты принадлежат @HansPassant.