A static library or statically-linked library is a set of routines, external functions and variables which are resolved in a caller at compile-time and copied into a target application by a compiler, linker, or binder, producing an object file and a stand-alone executable. This executable and the process of compiling it are both known as a static build of the program.
Questions tagged [static-linking]
1772 questions
0
votes
1 answer
Linking problems on windows (boost)
I'm trying to compile boost and mongodb.
I want 64bit versions, shared libs and dynamic linking to the runtime.
Boost is compiled with link=shared, runtime-link=shared, threading=multi (and some others). The lib and dll files have names like:…

tauran
- 7,986
- 6
- 41
- 48
0
votes
1 answer
static linking in the make file at kernel level
i have created a kernel module that uses kernel level functions such as vfs_read, write etc. This module has a makefile that builds this module to get the .ko file. I want to analyze the objdump output of this .ko file. However I observed that…

prap19
- 1,818
- 3
- 16
- 26
0
votes
0 answers
MinGW standard library static linking
I have a simple program which uses standard library functions like malloc(), free() and I want to link them statically. I tried options: -static -static-libstdc++ -static-libgcc but nothing is working.

Peter
- 23
- 5
0
votes
1 answer
g++ fails to link libraries while creating a shared object
I am trying to create a static library for my engine.
The command (in a makefile) is:
g++ -c -fPIC window.cc -lGL -lGLEW -lSDL2 -std=c++14 -I../include/ && g++ -static window.o -lSDL2 -lGL -lGLEW -o ../distribute/so/window.so
So, the first command…
user7927120
0
votes
1 answer
Static linking agains boost.test with cmake for mingw on windows
I would like to compile my project on windows 7, using mingw-4.9, cmake 3.8, and with Boost 1.63.0.
It's a standalone unittest project. It takes files from production source directory and test files from test folder mockups(substitution) are places…

Michal P.
- 53
- 7
0
votes
1 answer
getting an error linking sdl with g++
i know a lot of people have problems like this but none of the solutions have worked im linking to SDL heres my code:
#include
#include
int main()
{
return 0;
}
im using command-line g++ heres the command:
g++ main.cpp…

jake
- 3
- 1
0
votes
1 answer
Statically Linked Binaries - Segmentation fault
I'm trying to build static binaries for net-tools-1.60, so they can run on their own on any system. I downloaded the source for net-tools from SourceForge and applied 3 patches. Then I compile successfully with make SHARED=0 CC='gcc -static'. The…

user1781482
- 623
- 3
- 15
- 24
0
votes
2 answers
linking, compiling and running a c program with a static library
I'm new to C development.
A I built a library (static) in CLion
library.h
#ifndef MYLIB_LIBRARY_H
#define MYLIB_LIBRARY_H
int add(int a, int b);
int sub(int a, int b);
#endif
library.c
#include "library.h"
#include
int add(int a, int…
user7014993
0
votes
0 answers
Crash when initiating an object of a class from static lib
I'm compiling a 3rd party code (which is given as a VS solution) to a static library. This code has one class which is for simplification looks like this:
Sample.h:
class Sample
{
public:
Sample();
~Sample();
void Foo();
private:
…

Sanich
- 1,739
- 6
- 25
- 43
0
votes
2 answers
Is there a way to join (link?) a managed (.net) dll at compile time?
I'm building a project which consists of two .net executables, and a class library with common components that the two executables share. For ease of distribution, I was hoping to be able to distribute the two executables without distributing the…

kdmurray
- 2,988
- 3
- 32
- 47
0
votes
1 answer
Nested Static Linked Libraries and a Spooky Bug
(Platform: C++14, Clang 3.8, Ubuntu 16.04, CMake 3.5.1)
I have two static libraries (PawLIB, CalikoCat), and an executable that relies on OtherLibrary. Within CalkoCat is a single class, Dummy. (I'm just making sure everything links right before we…

CodeMouse92
- 6,840
- 14
- 73
- 130
0
votes
1 answer
Issues statically linking libcurl in win32 console project VS2015
I am having some issues regarding statically linking libcurl into my Win32 console project in Visual Studio 2015. I have been struggling with this issue for 4-5 hours and I could not figure it out. I am hoping someone can help me explain what I am…

Steffen Brem
- 1,738
- 18
- 29
0
votes
1 answer
Runtime "symbol lookup error" after compilation and linking of .so
first of all I've searched this one quite a bit and haven't managed to find a question with the same situation.
I'm building a 32 bit plugin as a shared-object on a 64 bit machine and using cpp-redis. cpp-redis built fine and I used a cmake…

Southclaws
- 1,690
- 2
- 16
- 25
0
votes
1 answer
Qt5 static linking fails on Ubuntu Linux
Here is what I did:
1. Downloaded sources
2. ./configure -static -prefix /home/user/build/qt-static/build -qt-xcb
3. make -j3
4. make install
5. After 1h of building, I made a simple test.cpp:
#include
int main(int argc, char…

westernCiv
- 29
- 7
0
votes
0 answers
'-l' flag makes no difference in linking
I've been compiling some codes and found that the -llibrary flag has no effect in linking. Haven't really dealt with C++ before, so may be a simple mistake...
Here is the command I am using:
compiling:
g++ -c -Wall -std=c++11…

Charlie Lam
- 111
- 7