- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在尝试使用包含其他静态库的静态库。
有两个项目:Engine、MyGame
'Engine' 将生成 Engine.lib
'MyGame' 将在链接时使用 Engine.lib。
以下是我从 visual studio 2012 获得的构建消息:
1>------ Rebuild All started: Project: Engine, Configuration: Debug Win32 ------
2>------ Rebuild All started: Project: MyGame, Configuration: Debug Win32 ------
1> Precompiled.cpp
2> Main.cpp
2>LINK : fatal error LNK1104: cannot open file 'D:\klee\Engine\Debug\Engine.lib'
1> RenderGame.cpp
1> RenderDebug.cpp
1> MsgHandler.cpp
1> Main.cpp
1> Log.cpp
1> Input.cpp
1> Interface.cpp
1> Helper.cpp
1> GameObject.cpp
1> Framework.cpp
1> Engine.cpp
1> Config.cpp
1> Component.cpp
1> Generating Code...
1> Guicon.cpp
1>glu32.lib(GLU32.dll) : warning LNK4006: __NULL_IMPORT_DESCRIPTOR already defined in glew32.lib(glew32.dll); second definition ignored
1>glu32.lib(GLU32.dll) : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
1>opengl32.lib(OPENGL32.dll) : warning LNK4006: __NULL_IMPORT_DESCRIPTOR already defined in glew32.lib(glew32.dll); second definition ignored
1>opengl32.lib(OPENGL32.dll) : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
1>SDL2.lib(SDL2.dll) : warning LNK4006: __NULL_IMPORT_DESCRIPTOR already defined in glew32.lib(glew32.dll); second definition ignored
1>SDL2.lib(SDL2.dll) : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
1> Engine.vcxproj -> D:\klee\Engine\Debug\Engine.lib
========== Rebuild All: 1 succeeded, 1 failed, 0 skipped ==========
起初,“MyGame”似乎无法找到 Engine.lib,但该项目确实生成了运行良好的可执行文件。
其次,“引擎”包括其他库(SDL2、OpenGL、GLEW)来生成其新库,但它表示符号是重复的。
“符号”到底是什么意思?
链接时“公开”符号是什么意思?
如果这些警告很严重,为什么会这样,我该如何解决?
如何配置项目之间的构建顺序?
在我的项目中使用外部库有什么最佳做法吗?
两个项目共享一些 dll(SDL2.dll、glew.dll)。如果其他用户要使用这个Engine.lib,我该如何提供这些dll?
谢谢。
最佳答案
一些答案,按逻辑(非顺序)顺序:
re: 4:MyGame 必须包含对 Engine 的引用。除其他外,这将强制 MyGame 仅在 Engine 完成后才开始构建,并避免您遇到的错误。请注意,一种用于强制构建顺序的旧设备仍然受到尊重(“项目依赖性”),但您今天需要一个特殊的理由才能使用它。
re 1:此上下文中的符号是链接器工作的“原子”。它可以是一个函数或一个全局变量,可以在多个翻译单元中使用。
re 3:这些警告并不严重。这里的LNK4006最终来自static libs including reference to other static libs (MS 允许但不鼓励这样做)。 LNK4221 是 most probably misuse of wizard-generated precompiled header files
re 6:原则上,您的安装程序必须安装您使用的任何第 3 方组件,并将它们连接起来,以便您的二进制文件找到它们(注册表项、环境变量等)。 SDL2(is that it?)可能就是这种情况,但 OpenGL 实际上是随 Windows 一起提供的 - 所以除非您使用的是一些奇特的版本,否则您应该没问题。
关于c++ - 使用包含另一个静态库的静态库时出现 LNK4006、LNK4221 警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24103488/
几天前我问了一个类似的问题,它帮助我找到了 __declspec() 的正确方向,但我又被卡住了。我会尽可能清楚。希望有人能告诉我我做错了什么。它可能是一些小而简单的东西。 项目信息: jc:
我想在某些特定路径中创建某些文件的快捷方式(.lnk)。例如在 ("H:\happy\hi\new.lnk") 中创建我的文件 ("D:\New folder\new.exe") 的快捷方式我想用 p
This question already has answers here: What is an undefined reference/unresolved external symbol er
这个问题在这里已经有了答案: What is an undefined reference/unresolved external symbol error and how do I fix it?
我的 disk-on-key 中有一个可执行文件,位于 dir\program\prog.exe我想在 DoK 的根目录上有一个可执行文件的快捷方式,即 prog.lnk 将引用 dir\progra
我一直在寻找一种在 C# 中创建文件快捷方式的简单方法,但我只找到了执行此操作的外部 dll。这实际上非常令人惊讶,没有内置的方法可以做到这一点.. 无论如何,我知道 lnk 文件只是具有特定命令和给
我一直在寻找问题的解决方案,遇到了 JasonMArcher 回答的帖子,想知道我是否可以更具体地满足我的需求。 我们最近更换了一个新服务器,由于它的名称从//sbcmaster 更改为//sbcse
我有一堆.lnk文件,需要根据快捷方式指向的目标来区别对待它们。我发现很少有其他语言如何做到这一点,但与使用powershell做到这一点无关。 我已经试过了: $sh = New-Object -C
我在使用C++创建快捷方式时遇到问题。.lnk文件已创建,但是目标具有无效路径。 您能解释一下为什么这段代码没有创建正确的快捷方式吗?有人可以帮我修复我的代码吗? 这是代码 // RepChrome.
rmap_utils.h #ifndef UTILS_RANGE_MAP_H #define UTILS_RANGE_MAP_H #include #include #include #incl
这个问题在这里已经有了答案: Can't set value of static object field (error LNK2001: unresolved external symbol) (
我刚刚使用 NuGET 包管理器安装了 SFML 包。安装后。我从它的官方页面运行了一个基本程序。只需复制和粘贴。 #include int main() { sf::RenderWindo
这个问题在这里已经有了答案: Can't set value of static object field (error LNK2001: unresolved external symbol) (
这个问题已经有答案了: Windows shortcut (.lnk) parser in Java? (9 个回答) 已关闭 6 年前。 我在Windows的“最近的项目”中有一些文件夹/文件。我想
首先,对不起我的英语..如何将现有的快捷方式包含到我的解决方案中? 当我尝试将现有项目添加到我的项目中时,visual studio 似乎尝试添加链接目标,而不是链接本身,因为它给我以下错误: 找不到
我们有一个充满指向文件夹的快捷方式(.lnk 文件)的网络驱动器,我需要在 C# Winforms 应用程序中以编程方式遍历它们。 我有哪些实用选择? 最佳答案 添加 IWshRuntimeLibra
我正在编写 32 位服务应用程序,我希望能够在其中为登录用户 启动“开始”菜单项。我确实设法通过模拟用户并使用 CreateProcessAsUser 和命令行启动选定的 .lnk 文件来完成此任务:
当您尝试打开不再有效的快捷方式文件 (.lnk) 时,Windows 会提示您:“此快捷方式已被更改或移动,因此此快捷方式将不再正常工作。”是否有 python 代码可用于检测此类快捷方式是否不再有效
我有一个名为 Siemens NX 的程序的多个版本。 NX 使用环境变量进行配置。我需要 NX 10.0 使用一组与使用系统环境变量的 NX 7.5 不同的环境变量。因此,我编写了一个批处理文件来设
我有一个打开 *.postfix 文件的 c# 程序。 如果用户运行指向我的文件类型的 (.lnk) 快捷方式,我的程序将打开目标。 那么,我的程序怎么知道它是由 (.lnk) 快捷方式启动的(并获取
我是一名优秀的程序员,十分优秀!