问题标签 [static-libraries]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
c - 为什么 __attribute__((constructor)) 不能在静态库中工作?
在以下示例中,程序应打印"foo called\n"
:
如果程序是这样编译的,它可以工作:
但是,如果 foo.c 被编译成静态库,则程序不会打印任何内容。
为什么会这样?
c - 静态和动态链接同一个库
我有一个静态链接到库 ( libA.2.0.a
) 并动态链接到另一个库 ( libB.so
) 的程序。libB.so
还动态链接到旧版本的 libA ( libA.1.0.so
)。
这种配置可行吗?如果是这样,系统如何知道使用来自libA.2.0.a
for 我的程序的符号和来自libA.1.0.so
for的符号libB.so
?
c++ - C++ 静态库可以链接到共享库吗?
假设我有一个静态 C++ 库 static.lib,我想从 C++ 共享库中调用一些函数,比如 shared.lib。是否可以?
现在假设我有另一个共享库,比如 shared2.lib,它链接到 static.lib 但不链接到 shared.lib。在这种情况下,链接器会自动将 shared2.lib 链接到 shared.lib 吗?
我正在使用 Microsoft Visual Studio 2003。
static-libraries - Solaris 上的静态代码?
问题:
/usr/lib/*.a
为什么从Solaris 10中删除了静态库?- 所以不可能生成静态链接的对象?
- 动态链接编译,是唯一的选择吗?
c++ - 即使选择了指向 ATL 的静态链接,Atl71.dll 依赖仍然存在
我已经花了一整天的时间来解决这个问题,但还没有运气。在我的项目中,我在通用属性页上将使用 ATL 属性设置为静态链接到 ATL,并在代码生成属性页( C/C++ 文件夹)上将运行时库属性设置为多线程 (/MT )。但是 DependencyWalker 仍然显示 Atl71.dll 依赖项。
我用谷歌搜索,发现这个页面http://www.eggheadcafe.com/forumarchives/vcatl/Mar2006/post26077463.asp有一个在atlbase.h之后添加atlwin.h的解决方案。该解决方案确实有助于减少对 atl71.dll 的依赖。但是它引入了一个新问题,即 CreateWindow 无法正常工作。
hwnd 为 NULL。
所以不能使用添加atlwin.h的解决方案,不知道有没有人遇到过类似的静态链接问题?如何解决?
环境:VS 2003 .Net
谢谢!
c++ - 我应该将 sqlite3 链接为纯对象代码还是 C++ 应用程序中的静态库?
我正在用 C++ 构建一个使用 sqlite3 作为嵌入式数据库的应用程序。sqlite3 的源代码作为一个合并的源代码文件sqlite3.c
和两个头文件分发。
将 sqlite3 代码直接链接到我的程序二进制文件与将 sqlite3 编译为静态库并以这种方式链接它的相对优点或缺点是什么?
我已经决定不将 sqlite3 代码作为动态库链接。
c++ - .LIB 和 .OBJ 文件有什么区别?(Visual Studio C++)
我知道 .OBJ 是编译一个编译单元的结果,而 .LIB 是一个可以从多个 .OBJ 创建的静态库,但这种差异似乎仅在于编译单元的数量。还有其他区别吗?它是相同的还是不同的文件格式?
当我想知道在两个(或更多).LIB 中定义的相同静态变量是否在链接到最终可执行文件期间被合并时,我遇到了这个问题。对于 .OBJ,变量被合并。但在.LIBs 中是否相同?
c++ - 在 Qt Creator 中使用静态库
我花了很长时间寻找清楚地解释了如何在 Qt Creator 中使用静态库的文档。
我已经使用 Qt Creator 创建并编译了我的静态库(New=>Projects\C++ Library=>Set type to "Statically Linked Library")。它编译并吐出一个“.a 文件”。
我遇到的问题是当我尝试使用该库时。我有另一个想要使用它的项目(库中的#include 文件等),但我不知道与库链接或包含库中的文件的正确方法。
iphone-sdk-3.0 - Does OS matter when compiling for iPhone?
I fairly new on iPhone development and I'm currently trying to add some static libraries to my project but I get the "Symbol(s) not found" error.
I've googled the issue and tried different solutions without any luck. The libraries are compiled on a PC and not on a Mac so my questions are:
Do I need to compile the code on a Mac? What tool(s) do I need to be able to compile them?
I have included the headers to the project. The code I'm trying to link to are written in c and are compiled for ARM GCC 4.2.
I get the following errorcode:
ld warning: in /Users/<>/Playground/Collage/libbaseapi.a, file is not of required architecture ld warning: in /Users/<>/Playground/Collage/capseng.a, file is not of required architecture ld warning: in /Users/<>/Playground/Collage/excodecs.a, file is not of required architecture ld warning: in /Users/<>/Playground/Collage/fmautorama.a, file is not of required architecture ld warning: in /Users/<>/Playground/Collage/fmclearshot.a, file is not of required architecture ld warning: in /Users/<>/Playground/Collage/fmexif.a, file is not of required architecture ld warning: in /Users/<>/Playground/Collage/fmextencoder.a, file is not of required architecture ld warning: in /Users/<>/Playground/Collage/fmfacewarp.a, file is not of required architecture ld warning: in /Users/<>/Playground/Collage/fmfxplugin.a, file is not of required architecture ld warning: in /Users/<>/Playground/Collage/fmimageenhance.a, file is not of required architecture ld warning: in /Users/<>/Playground/Collage/fmimagefusion.a, file is not of required architecture ld warning: in /Users/<>/Playground/Collage/fmjpegsqueeze.a, file is not of required architecture ld warning: in /Users/<>/Playground/Collage/fmjpegtools.a, file is not of required architecture ld warning: in /Users/<>/Playground/Collage/fmphotoart.a, file is not of required architecture ld warning: in /Users/<>/Playground/Collage/fmredaway.a, file is not of required architecture ld warning: in /Users/<>/Playground/Collage/fmsemc.a, file is not of required architecture ld warning: in /Users/<>/Playground/Collage/fmspeedview.a, file is not of required architecture
Undefined symbols: "_caps_destroyBuffer", referenced from: -[CollageMainView drawRect:] in CollageMainView.o ld: symbol(s) not found collect2: ld returned 1 exit status "_caps_destroyBuffer", referenced from: -[CollageMainView drawRect:] in CollageMainView.o ld: symbol(s) not found collect2: ld returned 1 exit status Build failed (1 error)
BR, Andreas
c++ - 初始化嵌入在静态库中的 qt 资源
我有下一个情况:我需要在独立静态库中创建小部件,然后将其与最终应用程序(visual c++ 9.0,qt 4.5)链接。这个静态小部件库包含一些资源(图标),并由几个 .cpp 文件组成(每个文件都包含独立的小部件)。据我所知,如果我在静态库中使用它们(资源),我必须初始化 qt 资源系统,并调用“Q_INIT_RESOURCE(resource_file_name)”。我用下一个代码解决了这个问题(在静态库中的每个 .cpp 文件中):
我没有使用第一种方法,而是在静态库项目中使用初始化代码创建了单独的 init.cpp 文件(以避免在每个 .cpp 文件中包含初始化代码),但这不起作用。
为什么这不起作用?
这种使用 StaticLibInitializer 的方法在各种编译器和平台之间是否安全且可移植?