static-libraries

Why does static library contain a main function?

ぃ、小莉子 提交于 2021-02-07 02:55:20
问题 I came across a weird static library which contains a main() function (C++). I just wonder what the purpose it is. How does the main() execute? 回答1: From the linker perspective, it doesn't matter where the main function is - it can be in a static library as well as in standalone object file, linker couldn't care less. It produces the executable from object files, no matter where they come from, and in the final executable all the distinction between library/non library symbols is lost. As for

Why are static library symbols not included in dSYM during archive?

家住魔仙堡 提交于 2021-02-06 04:27:10
问题 We have a pretty major application suite for a client with a couple application targets utilizing several static libraries that we made in house. All targets are contained in one XCode project file. For some reason when archiving an application the dSYM file does not contain any debug symbols for static libraries. The result is when trying to symbolicate crash logs from field agents we cannot see what is going on inside those static libraries. I attempted to create a new simple XCode project

Convert qmake into CMake

会有一股神秘感。 提交于 2021-01-28 11:37:07
问题 I am new to CMake, but I used to use qmake. In my qmake, I have the following for adding a static library that is inside a folder called bin, inside the project folder: QT -= gui QT += core CONFIG += c++11 console CONFIG -= app_bundle DEFINES += QT_DEPRECATED_WARNINGS SOURCES += \ main.cpp macx: LIBS += -L$$PWD/bin/lib/ -lnanomsg INCLUDEPATH += $$PWD/bin/include DEPENDPATH += $$PWD/bin/include macx: PRE_TARGETDEPS += $$PWD/bin/lib/libnanomsg.a What is the corresponding CMake syntax? I tried

Add a static library (.a file) to an Android project with CMake, get “CMake Error: CMake can not determine linker language for target”

那年仲夏 提交于 2021-01-28 03:50:25
问题 I generate the static library from another Android project, so pretty sure they're useable. I got four .a files based on CPU architectures, one .h file which also has been tested. Now in new project, another .c file want to call the static library, i can't combine the two projects, the static libraries must be called in .a format. I got "CMake Error: CMake can not determine linker language for target", this is my CMakeLists.txt: add_library( mylib STATIC src/main/jniLibs/arm64-v8a/libmylib.a

Errors when compiling with the Cuba library

↘锁芯ラ 提交于 2021-01-28 01:40:39
问题 I am trying to use the "Cuba" "library", which defines multidimensional integration routines, and use those in a program in C (I usually use Mathematica, but for the integrals I need to calculate now, Mathematica has huge convergence problems). I installed the elements of the package Cuba-3.1.tar.gz ("new"), and tried to compile the demo file demo-c.c, but after many many hours of trials, I still have not succeeded (I only learnt a tiny bit of C in school, but have never used it since then,

Can't make my c++ file into a library with compiler

风格不统一 提交于 2021-01-27 23:35:44
问题 I am trying to compile my source code into a library but i get this error findingjimoh$ ar rcs libHeatingUnit.a HeatingUnit.o /usr/bin/ranlib: warning for library: libHeatingUnit.a the table of contents is empty (no object file members in the library define global symbols) The .a file is made but then i try to link it with an executable file and i get this error findingjimoh$ g++ -o TemperatureControl BangBangControl.cpp -L. libBangBangControl.a libHeatingUnit.a ld: warning: ignoring file

MSVC - Creating a static library via Makefile

喜夏-厌秋 提交于 2021-01-27 21:31:45
问题 So I've been trying to create a static library under Windows under MSVC by launching mingw32-make under Microsoft's x64 Command Line Tools. I get linker error LNK1561: entry point must be defined. For completeness, here's my Makefile. all: build\lib\libds.lib build\lib\libds.lib: build\obj\priority-queue.obj link /OUT:build\bin\libds.lib build\obj\priority-queue.obj build\obj\priority-queue.obj: libs/ds/priority-queue.c include/ds/priority-queue.h cl /Iinclude /c libs/ds/priority-queue.c /Fo

Libraries “rt” and “dl” in Cygwin

假装没事ソ 提交于 2021-01-27 13:55:27
问题 Perhaps this is stupid but I'm unable to find out which package I have to install in Cygwin to fix the following missing libraries: config.status: creating unix.buildinfo config.status: creating include/HsUnixConfig.h cabal.exe: Missing dependencies on foreign libraries: * Missing header file: HsUnix.h * Missing C libraries: rt, dl Any ideas or how do you generally find out which package to install when you get feedback that file xxx is missing (I remember that in gentoo this was quite

Xcode 9: Linking a static framework against another static framework

生来就可爱ヽ(ⅴ<●) 提交于 2021-01-27 07:59:56
问题 In the spirit of Xcode 9's "revolutionary" feature, namely compiling static frameworks, we are trying to make our subprojects build as static frameworks, so they can be linked statically against the main application target. One of our sub-projects has a static framework dependency itself (Firebase). When we build the sub-project as a dynamic framework, everything works fine, but once we switch it to mach-o staticlib, suddenly, it loses the Firebase library symbols. Here is the output of nm

Xcode 9: Linking a static framework against another static framework

[亡魂溺海] 提交于 2021-01-27 07:59:12
问题 In the spirit of Xcode 9's "revolutionary" feature, namely compiling static frameworks, we are trying to make our subprojects build as static frameworks, so they can be linked statically against the main application target. One of our sub-projects has a static framework dependency itself (Firebase). When we build the sub-project as a dynamic framework, everything works fine, but once we switch it to mach-o staticlib, suddenly, it loses the Firebase library symbols. Here is the output of nm