Questions tagged [static-libraries]
A static library is an archive of object files. Used as a linker input, the linker extracts the object files it needs to carry on the linkage.
4,496
questions
0
votes
1
answer
30
views
Undefined symbol when linking static library to Android NDK
I'm using a Gradle project provided by the SDL repository to use with Android builds. On its own, the project builds fine with full access to SDL. But I have a static library that I'm trying to link ...
0
votes
2
answers
104
views
What is a real purpose of dynamic linking in c++?
I'm new to this and don't understand why I should use dynamic linking when there is static linking.
I know that dynamic linking reduces the size of the program file, but if it is a custom dynamic ...
1
vote
0
answers
77
views
Compiling static C program doesn't find curl functions, even though linked
I'm trying to compile a C program statically. I tried adding "-static" option to the command line, but still get erros.
This is the command line.
gcc main.c -o main.exe -lcurl -static -L&...
2
votes
0
answers
61
views
Segfault when calling weak symbol in static library [duplicate]
For some reason I get a segfault when calling a weak function but only if I put the weak definition in a static library. Here are my source files:
// mylib.h
#pragma once
void hello(const char* name) ...
0
votes
0
answers
27
views
I need to know for sure if binary 64bit supports any 32-bit static libraries or not.?
I'm trying to figure out if I'm using 32-bit static library support in my target/local repo.
Although my architecture is 64-bit, my local repository contains a mixture of 32-bit (static, shared) and ...
0
votes
0
answers
24
views
protobuf.dll not found even though static linking is specified
I have a static library ppc2cpp_core.lib which I want to link statically with protobuf. This library is in turn used by ppc2cpp.exe, which (hopefully) forms a standalone executable. I am using vcpkg ...
0
votes
1
answer
70
views
Can a static C library cause filename collisions?
My static c library libmylib.a contains common file names such as array.o and linkedlist.o
If a user using my library has files with the same names (array.c and linkedlist.c) will they end up with ...
0
votes
1
answer
55
views
Ensure linker include specific files from static library
My goal is pretty much the same as that guy :
Static initialization and destruction of a static library's globals
The solution to link library with linker flag --whole-archive works well (at least ...
-1
votes
3
answers
48
views
Why such warning even though type is specified in .h file
There are 2 files libtest.h and libtest.c
libtest.h
int a;
libtest.c
#include "libtest.h"
a = 10;
When I compile libtest.c
cc -c libtest.c
libtest.o is generated but I get this warning. ...
0
votes
1
answer
38
views
Dependencies not being built from command line execution with Code::Blocks
This is all within a Windows environment.
I have a main project that depends on 2 libraries (e.g. lib.a). When I rebuild through the Code::Blocks IDE, it cleans both library projects and the main ...
0
votes
0
answers
26
views
QT Static version does not include external targetted libs
so I use static version,
all works fine, app exe is generated with all standard and qt dlls so its fine to open in any windows machine.
However the external libraries i link against the project are ...
0
votes
0
answers
71
views
Sharing global config variables between executable and static libraries via headers using namespace and inline static members
Im trying to share some common config variables between some of my related static libraries and enabling the variables to be initialized and set within the main function of an executable linking ...
0
votes
0
answers
38
views
C/C++ [GCC] - How to determine if library code is compiled as static (.a) or dynamic (.so)?
I have a C/C++ dynamic library which some users compile and use as static. The issue arises where I have a constructor/deconstructor in my dynamic library which causes an error when compiling as ...
0
votes
0
answers
21
views
How to statically link readline when using mingw on Linux?
I made a small CLI tool that uses readline() for completion and powerful editing capabilities. On Linux, I can use the dynamic library easily by including it as a dependency in the package manager. On ...
0
votes
0
answers
41
views
Trouble accessing shared Kotlin Multiplatform Mobile (KMM) code in iOS static library
I’ve been working on a Kotlin Multiplatform Mobile (KMM) project and have successfully shared common code between an Android app in Android Studio and an iOS app in Xcode. However, I’m facing an issue ...
-1
votes
1
answer
107
views
How can I use a library without a header file path in cmake?
I'm trying to create a simple library using cmake and create an app that uses it.
However, while creating an app, I must specify the path to the header file used in the library for the build to ...
0
votes
0
answers
31
views
static vs dynamic library linking case study: why does Minecraft dynamically link lightweight libraries e.g. GLFW?
I'm learning c++, currently trying to understand how to link libraries. The benefits of dynamic libraries I know of are: smaller binaries of final products, reusability (multiple applications can use ...
0
votes
0
answers
53
views
How to Integrate Kotlin Multiplatform Static libraries in xcode ios mobile
listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach {
it.binaries.staticLib {
baseName = "shared"
}
}
The above code shared Module level build.gradle.kts
...
0
votes
0
answers
26
views
Attempting to build libcurl using nghttp2 both static
I am attempting to build libcurl using a static version of NGHTTP2 on Windows 11. I keep getting an unsolved symbol error that does not make sense to me.
b(nghttp2_session.obj)' in function '...
0
votes
1
answer
71
views
Is it possible to create a statically linked library that includes git submodules in the archive file?
I am currently developing a graphics library in C that uses SDL2 along with other parts of their library ecosystem and would like to package the entire library into a single .a file for easy use after ...
0
votes
1
answer
38
views
How to link to nested static libraries with cmake
I'm working on a project in C where I have an internal library and a main program. The internal library has a dependency on libjpeg-turbo, and the main has a dependency on the internal library. I'm ...
1
vote
0
answers
56
views
How to build static executable without full path of static libraries? target_link_directories breaks the process of building static executables
I built a static executable with CMake.Here's my CMakeLists.txt
cmake_minimum_required(VERSION 3.25)
project(tmp2)
set(CMAKE_CXX_STANDARD 20)
set(BUILD_SHARED_LIBS OFF)
set(CMAKE_EXE_LINKER_FLAGS &...
0
votes
0
answers
72
views
How to use static library libsodium.lib in C++Builder?
Under C++Builder, I have encountered an error when linking trying to use static library libsodium.lib.
The test under Visual Studio works fine.
Any idea to help ?
This is my code :
// C++ Builder
//.....
0
votes
0
answers
40
views
Linker doesn't detect my static library made for raylib
I am currently trying to create a tiny library to make dialog boxes in raylib. When I try to use my Makefile, though, I get this error. Please note that I'm a bit new to c++!:
/sbin/ld: cannot find -...
0
votes
0
answers
60
views
How to Integrate the Sjeng Chess Engine into a SwuiftUI Project?
I am trying to make a simple IOS chess app in SwiftUI. I want to use the Sjeng chess engine the same way that the Apple (MacOS) chess game does.
I am assuming the following:
the Sjeng engine is a ...
8
votes
1
answer
805
views
Why is the constructor of a global variable not called in a library?
I have some legacy code with some singleton classes that register themselves using constructors of global variables. It's a large codebase, that's compiled into one executable. I have tried to ...
1
vote
0
answers
56
views
CMake how proper link internal static library for creating another one
My main problem is how to link internal static library to be able build other internal static library which needs headers from first one.
I have internal project which include 3 libraries and main ...
2
votes
0
answers
44
views
CGO can't import static lib c++ on window 10
I have problem with import custom static lib c++ on window 10.
My custom library use function c++ on Window (AtlCom.h, UIAutomation.h ) so I need use Visual Code to build them.
I build dynamic ...
0
votes
0
answers
28
views
Compiling ARM executable with static library, VFP register arguments error despite same compiler flags
I am developing a static library for a client, to be used on a Cortex M4F processor. As a test platform, I am using a Texas Instruments Tiva C series board. When trying to link an executable against ...
0
votes
1
answer
36
views
How do I build librevenge static libraries (*.lib) for use in Windows?
I am unable to find a working solution for building the librevenge static libs for Windows.
For wider context, I need to build the librevenge static libraries because this is a dependancy for the ...
0
votes
0
answers
51
views
Rust to C++ as Static Library on Windows [duplicate]
I want to create a static library in rust and use it later in c/c++.
I already tried a few things and always get:
undefined reference to `hello_rust'
collect2.exe: error: ld returned 1 exit status
my ...
0
votes
1
answer
54
views
How to import external C libraries in VSCODE
I come here, as I am at a complete loss.
I, for the love of God, cannot manage to include a MySql library properly.
I'm using VSCode, set up c_cpp_properties.json includePath to include mysql, as well ...
2
votes
0
answers
40
views
Gcc can't find symbols that are actually here in the shared libraies while linking a C program [duplicate]
Problem I've encountered
I've built shared libraries from the source of the project libunwind libunwind - github
I finally got libraries files installed in /usr/local/lib
/usr/local/lib/
├── ...
├── ...
0
votes
0
answers
14
views
Not able to use pod dependency in Swift static library
I have built a static library in Swift, which internally uses Alamofire for network connections. I have used Pods to include this dependency and my idea is that host app (that will use my library) ...
0
votes
1
answer
24
views
Get the current users language in static class of domain project
I have 2 Projects in my solution
Api which is the runnable project and contains the api enpoints
Domain which holds the entites and the validators (fluent validation) for them
Now I will have to ...
0
votes
0
answers
32
views
How can I create an interface library? [duplicate]
I have a static library that I want to use in different places of my c project. I'm using CMake as a build automation tool. CMake offers the possibility to add a property to a library, and the one I'm ...
0
votes
0
answers
39
views
How to solve an unresolved external symbol error in Visual Studio project that references an Oracle C library?
I have a simple VS project that contains a Sample.c generated by a Pro*C compiler. This file doesn't do any thing fancy, it just try to connect to an Oracle database.
I'm getting the following error ...
0
votes
0
answers
30
views
Cannot compile static despite specifying -DBUILD_SHARED_LIBS=OFF
I have the following CMakeLists.txt
cmake_minimum_required(VERSION 3.16)
project(LSODrinkServer VERSION 0.1 LANGUAGES C)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
list(...
0
votes
1
answer
118
views
linking error with GLFW library (undefined reference to)
I am trying to learn OpenGL, and I am a bit stuck with linking necessary libraries. NOTE: I use WSL, trying to build an executable for Windows with CMake and mingw-w64 (i686-w64-mingw32-g++ compiler).
...
0
votes
1
answer
37
views
organising header files for c++ library after install
I am building a small utility library with c++ and thus far I have pretty much always consumed my libraries in place, i.e. they were always mixed with my actual code that consumes the library which ...
0
votes
0
answers
11
views
IDAPRO signature can't recognize open source library function
Im trying to analysis a malware,Its include libevent library.
I have compiled libevent static library and create .sig file for IDAPRO.
But when i applying the .sig file in IDAPRO,its recognize 0 ...
1
vote
0
answers
181
views
MSYS2 Qt 6 static build fails with tons of unresolved symbols
I am trying to use the static Qt 6 package provided by MSYS2 but to no success.
The same code is building just fine with Qt 5.15 dynamic, Qt 5.15 static and Qt 6.5 dynamic builds, but the Qt 6.5 ...
0
votes
1
answer
107
views
Valid pointer from static library code treated as a nullptr in the application code
I'm running a demo C++ application based on TensorFlow Lite Micro framework on Linux x64 machine. I've built the default library (actually an ar archive) and linked it against my demo app.
After some ...
0
votes
0
answers
55
views
Android NDK linking to static libary problem
Device: Galaxy Tab S6.
Android Studio + plugins (latest versions as of 23/06/28, SDK 34, NDK 25.2, ...)
Development Computer: Windows 10
App type: Native C++
We created a Native C++, configured ...
1
vote
2
answers
127
views
Checking that a static library does not contain undefined symbols exept ones from libc and stdlib
I build a c++ software module that is delivered as header files (.h) containing the API and a static library (.a) with the implementation.
The module only depends on standard libraries so I want to ...
1
vote
2
answers
214
views
How to correctly change dynamic pod library to static?
The third party library began to support only the static cocoapods library. Before that, it was connected as dynamic
After changing the dynamic library to a static one, such an error began to appear
...
0
votes
0
answers
40
views
Should I share --sysroot option with the library's Makefile as well?
I've created an application and a couple of libraries. All these codes need to be cross-compiled for an embedded platform. I have got a custom root file system generated for the Linux kernel which ...
1
vote
0
answers
109
views
Optimizing static library with LTO at the public API boundary
Intro
I have a set of fairly large and complex static libraries for an embedded target that I want to optimize with LTO at the boundary of the public API. I have a project with the following layout:
...
0
votes
1
answer
790
views
How to link against a static library?
I've a compiled static library, but don't have the code of it. I know the library embeds lots of files on compilation and looks something like this:
//files.zig
const std = @import("std");
...
0
votes
0
answers
10
views
Podspec add static libraries for different architectures
I am trying to add in my Podspec file via s.ios.vendored_library, 2 static libraries depending of the architecture they're built on arm64/myLib.a and armv7/myLib.a.
But the following command seems to ...