发布编译c++;来源 我在编译C++程序时遇到了一个问题,我试图找到问题并解决它,但目前我还没能找到问题的根源。如果有人帮我一把,我将不胜感激:)
给出的错误是:(使用gcc 4.4.7在Centos 6.3下编译)发布编译c++;来源 我在编译C++程序时遇到了一个问题,我试图找到问题并解决它,但目前我还没能找到问题的根源。如果有人帮我一把,我将不胜感激:),c++,linux,gcc,trinitycore,C++,Linux,Gcc,Trinitycore,给出的错误是:(使用gcc 4.4.7在Centos 6.3下编译) 包含在/home/server/Sources/MOP/MistCore/src/server/scripts/PrecompiledHeaders/ScriptPCH.h:25中的文件中, from/home/server/Sources/MOP/MistCore/src/server/game/Anticheat/AnticheatMgr.h:7, from/home/server/Sources/MOP/MistCore
包含在/home/server/Sources/MOP/MistCore/src/server/scripts/PrecompiledHeaders/ScriptPCH.h:25中的文件中,
from/home/server/Sources/MOP/MistCore/src/server/game/Anticheat/AnticheatMgr.h:7,
from/home/server/Sources/MOP/MistCore/src/server/game/Anticheat/AnticheatData.h:4,
来自/home/server/Sources/MOP/MistCore/src/server/game/Anticheat/AnticheatData.cpp:1:
/home/server/Sources/MOP/MistCore/src/server/game/Spells/SpellScript.h:在构造函数“AuraScript::AuraScript()”中:
/home/server/Sources/MOP/MistCore/src/server/game/Spells/SpellScript.h:619:错误:调用“std::shared\u ptr”时没有匹配的函数
SpellScript.h
:
是的,这是一段很长的代码。根据,std::shared\u ptr
是在C++11中引入的
使用GCC编译C++11需要其版本4.7或更高版本
请注意,MistCore基于TrinityCore,它使用一个简单的Aura*
指针,而不是使用名为AuraPtr的C++11特定定义。将其恢复到原始状态应该像在原始项目中一样有效
您只需编辑/src/server/game/SharedPtrs/SharedPtrs.h
,并通过用简单指针替换定义来撤销std::shared_ptr
的需要。但不能保证它能解决所有问题 您可以使用-std=c++11指定标志,编译时仍有错误。。。所以如果我使用GCC4.7应该修复它吗?尝试一下,也许升级编译器是一个更好的选择,因为C++11特定更改的扩展是不确定的。
In file included from /home/server/Sources/MOP/MistCore/src/server/scripts/PrecompiledHeaders/ScriptPCH.h:25,
from /home/server/Sources/MOP/MistCore/src/server/game/Anticheat/AnticheatMgr.h:7,
from /home/server/Sources/MOP/MistCore/src/server/game/Anticheat/AnticheatData.h:4,
from /home/server/Sources/MOP/MistCore/src/server/game/Anticheat/AnticheatData.cpp:1:
/home/server/Sources/MOP/MistCore/src/server/game/Spells/SpellScript.h: In constructor ‘AuraScript::AuraScript()’:
/home/server/Sources/MOP/MistCore/src/server/game/Spells/SpellScript.h:619: error: no matching function for call to ‘std::shared_ptr<Aura>::shared_ptr(NULL)’
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/shared_ptr.h:1263: note: candidates are: std::shared_ptr<_Tp>::shared_ptr(std::shared_ptr<_Tp>&&) [with _Tp = Aura]
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/shared_ptr.h:1238: note: std::shared_ptr<_Tp>::shared_ptr() [with _Tp = Aura]
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/shared_ptr.h:1236: note: std::shared_ptr<Aura>::shared_ptr(const std::shared_ptr<Aura>&)
make[2]: *** [src/server/game/CMakeFiles/game.dir/Anticheat/AnticheatData.cpp.o] Error 1
make[1]: *** [src/server/game/CMakeFiles/game.dir/all] Error 2
make: *** [all] Error 2