我正在尝试创建一个新的测试项目,该项目使用google test来仅在调试和x86配置中为特定类编写单元测试。但是,对于xlocale头文件中定义的功能,我得到了无法解析的外部符号。我正在使用VS2015。
1>XPLProfileDefinitionCBL.obj : error LNK2019: unresolved external symbol "public: __thiscall CObject::CObject(void)" (??0CObject@@QAE@XZ) referenced in function "public: __thiscall CArray<struct XPLCallBarringArrayEntry,struct XPLCallBarringArrayEntry &>::CArray<struct XPLCallBarringArrayEntry,struct XPLCallBarringArrayEntry &>(void)" (??0?$CArray@UXPLCallBarringArrayEntry@@AAU1@@@QAE@XZ)
1>XPLProfileDefinitionCBLTests.obj : error LNK2001: unresolved external symbol "public: __thiscall CObject::CObject(void)" (??0CObject@@QAE@XZ)
1>XPLProfileDefinitionCBL.obj : error LNK2019: unresolved external symbol "public: static class std::locale::_Locimp * __cdecl std::locale::_Init(bool)" (?_Init@locale@std@@SAPAV_Locimp@12@_N@Z) referenced in function "public: __thiscall std::locale::locale(void)" (??0locale@std@@QAE@XZ)
1>XPLProfileDefinitionCBL.obj : error LNK2019: unresolved external symbol "public: static class std::locale::_Locimp * __cdecl std::locale::_Getgloballocale(void)" (?_Getgloballocale@locale@std@@SAPAV_Locimp@12@XZ) referenced in function "public: class std::locale::facet const * __thiscall std::locale::_Getfacet(unsigned int)const " (?_Getfacet@locale@std@@QBEPBVfacet@12@I@Z)
1>XPLProfileDefinitionCBL.obj : error LNK2001: unresolved external symbol "public: static int std::locale::id::_Id_cnt" (?_Id_cnt@id@locale@std@@2HA)
.vcsproj文件在下面给出。
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{6713825B-04E6-4F10-B2F1-DA2B97B0E909}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>XPLProfileDefinitionCBLTests</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
<UseOfMfc>false</UseOfMfc>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Create</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_ALLOW_KEYWORD_MACROS;XNT_NT;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(ProjectDir)../Tools/googletest/include;$(ProjectDir);$(ProjectDir)../SharedMocks/Cpp/ADSInclude;$(ProjectDir)../SharedMocks/Cpp/CDSInclude;$(ProjectDir)../SharedMocks/Cpp/ADSCallControl/CallProcessing;$(ProjectDir)../../ADSInclude;$(ProjectDir)../../ADSCallControl\XMLProfileLibrary</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<ShowIncludes>false</ShowIncludes>
<ExceptionHandling>Async</ExceptionHandling>
<StructMemberAlignment>1Byte</StructMemberAlignment>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>..\Tools\googletest\lib.v140.mt.x86.debug;</AdditionalLibraryDirectories>
<AdditionalDependencies>gmock.lib;gmock_main.lib;gtestd.lib;gtest_maind.lib;%(AdditionalDependencies)</AdditionalDependencies>
<IgnoreSpecificDefaultLibraries>
</IgnoreSpecificDefaultLibraries>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\ADSCallControl\XMLProfileLibrary\stdafx.h" />
<ClInclude Include="..\..\ADSCallControl\XMLProfileLibrary\XPLProfileDefinitionCBL.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\ADSCallControl\XMLProfileLibrary\stdafx.cpp" />
<ClCompile Include="..\..\ADSCallControl\XMLProfileLibrary\XPLProfileDefinitionCBL.cpp" />
<ClCompile Include="..\SharedMocks\Cpp\ADSCallControl\XMLProfileLibrary\XMLProfileLibrary.cpp" />
<ClCompile Include="..\SharedMocks\Cpp\ADSCallControl\XMLProfileLibrary\XPLProfileDefinition.cpp" />
<ClCompile Include="..\SharedMocks\Cpp\ADSCallControl\XMLProfileLibrary\XPLProfileDefinitionActivatable.cpp" />
<ClCompile Include="XPLProfileDefinitionCBLTests.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
请帮助我,谢谢。
这不是关于未解决的外部符号的问题,主要是关于为什么从标准头文件中获取错误的问题。