1.文件拷贝后问题:
1>------ 已启动生成: 项目: 工程名, 配置: Development_Server x64 ------
1>Building 工程名Server...
1>Using Visual Studio 2017 14.16.27045 toolchain (C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023) and Windows 10.0.16299.0 SDK (F:\Windows Kits\10).
1>[Upgrade]
1>[Upgrade] Using backward-compatible build settings. The latest version of UE4 sets the following values by default, which may require code changes:
1>[Upgrade] bLegacyPublicIncludePaths = false => Omits subfolders from public include paths to reduce compiler command line length. (Previously: true).
1>[Upgrade] ShadowVariableWarningLevel = WarningLevel.Error => Treats shadowed variable warnings as errors. (Previously: WarningLevel.Warning).
1>[Upgrade] PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs => Set in build.cs files to enables IWYU-style PCH model. See https://docs.unrealengine.com/en-US/Programming/BuildTools/UnrealBuildTool/IWYU/index.html. (Previously: PCHUsageMode.UseSharedPCHs).
1>[Upgrade] Suppress this message by setting 'DefaultBuildSettings = BuildSettingsVersion.V2;' in 工程名Server.Target.cs, and explicitly overriding settings that differ from the new defaults.
1>[Upgrade]
1>Building 2 actions with 8 processes...
1> [1/2] 工程名Server.exe
1>MultPlayerWAN_Test02.cpp.obj : error LNK2005: "wchar_t * GInternalProjectName" (?GInternalProjectName@@3PA_WA) 已经在 工程名.cpp.obj 中定义
1>MultPlayerWAN_Test02.cpp.obj : error LNK2005: "wchar_t const * const GForeignEngineDir" (?GForeignEngineDir@@3PEB_WEB) 已经在 工程名.cpp.obj 中定义
1>MultPlayerWAN_Test02.cpp.obj : error LNK2005: "wchar_t const * const GLiveCodingEngineDir" (?GLiveCodingEngineDir@@3PEB_WEB) 已经在 工程名.cpp.obj 中定义
1>MultPlayerWAN_Test02.cpp.obj : error LNK2005: "wchar_t const * const GLiveCodingProject" (?GLiveCodingProject@@3PEB_WEB) 已经在 工程名.cpp.obj 中定义
1>MultPlayerWAN_Test02.cpp.obj : error LNK2005: "class FChunkedFixedUObjectArray * & GObjectArrayForDebugVisualizers" (?GObjectArrayForDebugVisualizers@@3AEAPEAVFChunkedFixedUObjectArray@@EA) 已经在 工程名.cpp.obj 中定义
1>MultPlayerWAN_Test02.cpp.obj : error LNK2005: "void * __cdecl operator new(unsigned __int64)" (??2@YAPEAX_K@Z) 已经在 工程名.cpp.obj 中定义
1>MultPlayerWAN_Test02.cpp.obj : error LNK2005: "void * __cdecl operator new(unsigned __int64,struct std::nothrow_t const &)" (??2@YAPEAX_KAEBUnothrow_t@std@@@Z) 已经在 工程名.cpp.obj 中定义
1>MultPlayerWAN_Test02.cpp.obj : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPEAX@Z) 已经在 工程名.cpp.obj 中定义
1>MultPlayerWAN_Test02.cpp.obj : error LNK2005: "void __cdecl operator delete(void *,struct std::nothrow_t const &)" (??3@YAXPEAXAEBUnothrow_t@std@@@Z) 已经在 工程名.cpp.obj 中定义
1>MultPlayerWAN_Test02.cpp.obj : error LNK2005: "void __cdecl operator delete(void *,unsigned __int64)" (??3@YAXPEAX_K@Z) 已经在 工程名.cpp.obj 中定义
1>MultPlayerWAN_Test02.cpp.obj : error LNK2005: "void __cdecl operator delete(void *,unsigned __int64,struct std::nothrow_t const &)" (??3@YAXPEAX_KAEBUnothrow_t@std@@@Z) 已经在 工程名.cpp.obj 中定义
1>MultPlayerWAN_Test02.cpp.obj : error LNK2005: "void * __cdecl operator new[](unsigned __int64)" (??_U@YAPEAX_K@Z) 已经在 工程名.cpp.obj 中定义
1>MultPlayerWAN_Test02.cpp.obj : error LNK2005: "void * __cdecl operator new[](unsigned __int64,struct std::nothrow_t const &)" (??_U@YAPEAX_KAEBUnothrow_t@std@@@Z) 已经在 工程名.cpp.obj 中定义
1>MultPlayerWAN_Test02.cpp.obj : error LNK2005: "void __cdecl operator delete[](void *)" (??_V@YAXPEAX@Z) 已经在 工程名.cpp.obj 中定义
1>MultPlayerWAN_Test02.cpp.obj : error LNK2005: "void __cdecl operator delete[](void *,struct std::nothrow_t const &)" (??_V@YAXPEAXAEBUnothrow_t@std@@@Z) 已经在 工程名.cpp.obj 中定义
1>MultPlayerWAN_Test02.cpp.obj : error LNK2005: "void __cdecl operator delete[](void *,unsigned __int64)" (??_V@YAXPEAX_K@Z) 已经在 工程名.cpp.obj 中定义
1>MultPlayerWAN_Test02.cpp.obj : error LNK2005: "void __cdecl operator delete[](void *,unsigned __int64,struct std::nothrow_t const &)" (??_V@YAXPEAX_KAEBUnothrow_t@std@@@Z) 已经在 工程名.cpp.obj 中定义
1>MultPlayerWAN_Test02.cpp.obj : error LNK2005: "unsigned char * * GNameBlocksDebug" (?GNameBlocksDebug@@3PEAPEAEEA) 已经在 工程名.cpp.obj 中定义
1> VideoRecorder.lib(VideoRecorder.obj) : 找到 MSIL .netmodule 或使用 /GL 编译的模块;正在使用 /LTCG 重新启动链接;将 /LTCG 添加到链接命令行以改进链接器性能
1>MultPlayerWAN_Test02.cpp.obj : error LNK2005: "unsigned char * * GNameBlocksDebug" (?GNameBlocksDebug@@3PEAPEAEEA) 已经在 工程名.cpp.obj 中定义
1> 正在创建库 G:\UE4Code\…\工程名\Binaries\Win64\工程名Server.lib 和对象 G:\UE4Code\…\工程名\Binaries\Win64\工程名Server.exp
1>G:\UE4Code\…\工程名\Binaries\Win64\工程名Server.exe : fatal error LNK1169: 找到一个或多个多重定义的符号
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets(44,5): error MSB3075: 命令“F:\UE4_Download\UnrealEngine-4.24.3-release\Engine\Build\BatchFiles\Build.bat 工程名Server Win64 Development -Project="G:\UE4Code\…\工程名\工程名.uproject" -WaitMutex -FromMsBuild”已退出,代码为 5。请验证您是否拥有运行此命令的足够权限。
1>已完成生成项目“工程名.vcxproj”的操作 - 失败。
========== 生成: 成功 0 个,失败 1 个,最新 2 个,跳过 0 个 ==========
处理:
(1)模块名.h 文件添加:
public:
/* This will get called when the editor loads the module */
virtual void StartupModule() override;
/* This will get called when the editor unloads the module */
virtual void ShutdownModule() override;
(2)模块名.cpp文件
(2.1)添加:
void 模块名::StartupModule()
{
}
void 模块名::ShutdownModule()
{
}
(2.2)游戏主模块唯一性:
参考:Modules/ModuleManager.h
//IMPLEMENT_PRIMARY_GAME_MODULE( ModuleImplClass, ModuleName, GameName )
IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, 模块名, "游戏名" );
改为
IMPLEMENT_GAME_MODULE( ModuleImplClass, ModuleName );
IMPLEMENT_GAME_MODULE(模块实现类名, 模块名);
或者
IMPLEMENT_MODULE()( ModuleImplClass, ModuleName );
IMPLEMENT_MODULE(模块实现类名, 模块名);