[英]Where is the reference to static library in the Visual C++ project in VS 2012?
我應該在同一個解決方案中的2個項目中引用相同的靜態庫。 雖然鏈接一個項目有這個參考,但另一個項目沒有。 所以我在第二個項目中遇到鏈接錯誤。 但是,我只能在.vcxproj文件中看到區別:
一個人有這條線:
<AdditionalOptions>/ERRORREPORT:PROMPT ..\debug\membraneStaticLibr.lib DelayImp.lib %(AdditionalOptions)</AdditionalOptions>
另一個沒有這條線。 請參閱下面的代碼。
這與Visual C ++ GUI的項目屬性中反映的靜態庫的區別在哪里?
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalOptions>/ERRORREPORT:PROMPT ..\debug\membraneStaticLibr.lib DelayImp.lib %(AdditionalOptions)</AdditionalOptions>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
<LinkErrorReporting />
</Link>
AdditionalOptions字段可以在Project Properties - > Configuration Properties - > Linker - > Command Line中找到 。 但是,在那里指定依賴項是不可行的。 使用鏈接器中的“ 附加依賴項”字段,或者甚至更好地使用“ 公共屬性”中的項目引用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.