集成库导致错误 C++

发布于 2025-01-05 12:16:16 字数 3915 浏览 6 评论 0原文

我正在从事一个包含 DirectX SDK(2010 年 6 月)的 VC++ 2010 Windows 项目,另一个团队生成了一个物理库以合并到该程序中。当我检查并执行对库的所有必需调用时,等等。我按照他们给出的指示来集成库:

extract the director containing the .h files into my c:\

在 C/C++>常规>附加包含目录中,

c:\physics_core        // without additional additional dependencies 

然后在链接器>输入>附加依赖项中

C:\physics_core\PhysicsCore\Release\PhysicsCore.lib    // without additional additional dependencies 

包含管理器,并使用方法中提供的命名空间,并且需要调用对象(智能甚至尝试建议自动正确完成)。但随后我的编译器抛出以下列表。我非常确定前 6 个与库本身有关,其他与 directX 有关。

1>  PhysicsCore.lib(PhysicsMgr.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
1>LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification
1>PhysicsCore.lib(PhysicsMgr.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in MainCore.obj
1>PhysicsCore.lib(Box3D.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in MainCore.obj
1>PhysicsCore.lib(Circle3D.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in MainCore.obj
1>PhysicsCore.lib(Box2D.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in MainCore.obj
1>PhysicsCore.lib(Circle2D.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in MainCore.obj
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__UpdateWindow@4
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__ShowWindow@8
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__CreateWindowExW@48
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__RegisterClassExW@4
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__LoadCursorW@8
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__DefWindowProcW@16
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__PostQuitMessage@4
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__InvalidateRect@12
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__AddFontResourceExW@12
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__GetWindowRect@8
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__DispatchMessageW@4
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__TranslateMessage@4
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__PeekMessageW@20
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__UnregisterClassW@8
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__RemoveFontResourceExW@12
1>C:\general\...\Engine\Debug\test.exe : fatal error LNK1120: 15 unresolved externals

问题是,当我将程序回滚到集成物理库之前,一切都按预期进行。创建该库的人告诉我,它在他们尝试使用它的所有系统上都运行良好,但他们从未尝试在 Windows 程序中使用它,并且他们向我保证这与它无关是一个Windows应用程序。当我问他们是否使用任何特殊标志(例如第一个链接器警告状态)时,他们说他们没有使用这样的标志(首席程序员甚至不知道它们是什么,或者如何设置它们)。集成物理之前的构建使 directX 甚至渲染也能正常工作。

任何帮助都会很棒。

更新:将链接器>输入>附加依赖项更改为

C:\physical_core\PhysicsCore\Debug\PhysicsCore.lib 可能需要在发布时将其更改为

修复了前 6 个错误的原始版本,但未解决的外部问题仍然存在

更新: 情况解决了。

通过对同一属性行采取 2 个操作,所有错误均得到解决。

1 确保在调试模式下使用库的调试版本。

2 检查相关库的依赖关系,如果有重叠则将其包括在内。因为编译器首先检查正在使用的任何库的依赖项列表,然后检查项目的依赖项。如果存在任何重叠,则第一个保留,后面的所有重叠都将被忽略,但如果包含依赖项标志未设置为 true,则编译器将不会包含它们。 因此,解决该情况的更正行位于“链接器”>“输入”>“其他依赖项”中,需要更改为:

C:\physics_core\PhysicsCore\Debug\PhysicsCore.lib    // include additional dependencies

再次感谢您的所有帮助。

I am working in a VC++ 2010 windows project that incorporates DirectX SDK (June 2010), and another team generated a physics library to incorporate into the program. When I go through and perform all required calls to the library, and all. and I followed the directions that they gave to integrate the library:

extract the director containing the .h files into my c:\

in C/C++>general>Additional Include Directories place

c:\physics_core        // without additional additional dependencies 

then in Linker>Input>Additional Dependencies place

C:\physics_core\PhysicsCore\Release\PhysicsCore.lib    // without additional additional dependencies 

then include the manager, and use the namespace provided wherever the methods, and objects need to be called (intellisence even attempts to suggest auto completes correctly). but then my compiler throws the following list. I am pretty sure that the first 6 have to do with the library itself, and the others have to do with directX.

1>  PhysicsCore.lib(PhysicsMgr.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
1>LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification
1>PhysicsCore.lib(PhysicsMgr.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in MainCore.obj
1>PhysicsCore.lib(Box3D.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in MainCore.obj
1>PhysicsCore.lib(Circle3D.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in MainCore.obj
1>PhysicsCore.lib(Box2D.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in MainCore.obj
1>PhysicsCore.lib(Circle2D.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in MainCore.obj
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__UpdateWindow@4
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__ShowWindow@8
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__CreateWindowExW@48
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__RegisterClassExW@4
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__LoadCursorW@8
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__DefWindowProcW@16
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__PostQuitMessage@4
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__InvalidateRect@12
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__AddFontResourceExW@12
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__GetWindowRect@8
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__DispatchMessageW@4
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__TranslateMessage@4
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__PeekMessageW@20
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__UnregisterClassW@8
1>MainCore.obj : error LNK2001: unresolved external symbol __imp__RemoveFontResourceExW@12
1>C:\general\...\Engine\Debug\test.exe : fatal error LNK1120: 15 unresolved externals

the thing is when I roll the program back to before I integrate the Physics Library everything works like it is supposed to. the people who created the library tell me that it works fine on all the system(s) they tried to used it on, but they never attempted to use it in a windows program, and they assure me that it is nothing to do with it being a windows application. when I asked if they used any special flags like the first linker warning states they said that they used no such flag (the lead programmer didn't even know what they were, or how to set them). the build before integrating physics had directX working fine even rendering.

any help would be great.

Update: changed the Linker>input>Additional Dependencies to

C:\physics_core\PhysicsCore\Debug\PhysicsCore.lib
may need to change this under release to be the original

that fixed the first 6 errors, but the unresolved externals still exist

Update:
situation solved.

the all errors were solved by taking 2 actions regarding the same properties line.

1 insuring that a debug build of the Library was being used during debug mode.

2 checking the dependencies of the library in question, and including them if there is any overlap. as the compiler first checks the dependencies list of any libraries being used, and then checks the dependencies of the project. if there is any overlap the first one stands, and all those there after are ignored, but if the include dependencies flag is not set to true the compiler will not include them.
so the corrected line to solve the situation was in the Linker>Input>Additional Dependencies needed to be changed to:

C:\physics_core\PhysicsCore\Debug\PhysicsCore.lib    // include additional dependencies

again thank you for all your help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

过气美图社 2025-01-12 12:16:16

必须修改属性行之一才能清除所有错误。
第一个更改是 .lib 的目录必须进行更正,以匹配构建 Debug 与 Debug、release 与release 的目录。

当重新激活库链接器中的“从父级继承或项目默认值”复选框时,其他问题得到解决。 (尽管合并图书馆的方向另有说明。

had to modify one of the properties lines in order to clear all errors.
first change was that the directory of the .lib had to be rectified to match that of the build Debug with Debug, and release with release.

the other issues were resolved when the "inherit from parent, or project default" check box in the library Linker was reactivated. (though the direction to incorporate the library said otherwise.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文