其中,VS 2012 中 Visual C++ 项目中对静态库的引用

Where is the reference to static library in the Visual C++ project in VS 2012?

本文关键字:静态 引用 项目 C++ VS 2012 Visual 其中      更新时间:2023-10-16

>我应该在同一解决方案中的 2 个项目中引用相同的静态库。 虽然链接一个项目有此引用,但另一个项目没有。所以我在第二个项目中遇到链接错误。但是,我只能在.vcxproj文件中看到差异:

一个有这样一行:

<AdditionalOptions>/ERRORREPORT:PROMPT ..debugmembraneStaticLibr.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 ..debugmembraneStaticLibr.lib DelayImp.lib %(AdditionalOptions)</AdditionalOptions>
  <GenerateDebugInformation>true</GenerateDebugInformation>
  <SubSystem>Console</SubSystem>
  <TargetMachine>MachineX86</TargetMachine>
  <LinkErrorReporting />
</Link>

">

其他选项"字段可以在"项目属性"->"配置属性"->"链接器->命令行"中找到。但是,不能在其中指定依赖项。使用链接器中的"其他依赖项"字段,甚至更好地使用">通用属性"中的项目引用。