Search Results

Search found 1 results on 1 pages for 'user278799'.

Page 1/1 | 1 

  • [GCC, linking] How to link app with static library + why this is not working

    - by user278799
    I have a problem. I wrote example code and I want to build it without the error: main.cpp.text+0x5): undefined reference to `test()' Library test1.c #include <stdlib.h> void test() { puts("Dziala"); } test1.h #ifndef TEST1_H #define TEST1_H extern void test(); #endif makefile all: gcc -c ./src/test1.c -o ./lib/test1.o ar rcs ./lib/libtest1.a ./lib/test1.o Program main.cpp #include <test1.h> int main() { test(); return 0; } makefile all: g++ -static -I../test1/include -L../test1/lib ./src/main.cpp -o ./build/MyApp -ltest1 What am I doing wrong?

    Read the article

1