Imagine that you have a project that consists of the following three C files in the same folder:
int jam_badger(int);
#include "jam.h"
int jam_badger(int a)
{
return a + 1;
}
#include "jam.h"
int main()
{
return jam_badger(2);
}
And you will create it using a bjam file for formatting, for example:
lib jam : jam.c <link>static ;
lib jam_badger : jam ;
exe demo : jam_badger main.c ;
You will receive an error message.
undefined reference to `jam_badger'
(I used bjam here because the file is easier to read, but you can use whatever you want)
"" , ( ).
, ld , , .
, -Wl, - -Wl, - --, :
g++ -o "libjam_candle_badger.so" -Wl,--whole-archive libjam_badger.a Wl,--no-whole-archive
, boost-build, , .