C-library not linking using gcc/g++
I have a c-library which I use in gcc. The library has the extension .lib but is always linked as a static library. If i write a program which uses the library as c-code, everything as a-ok. If I however rename the file to .cpp (doing simple stuff that works in both c/c++) I get undefined reference. These are simple small programs I write for testing purposes so no fancy stuff. I compile using: gcc -g -Wall -I <path to custom headers> -o program main.c customlibrary.lib -lm -lpthread The above works like a charm. However: g++ -g -Wall -I <path to custom headers> -o program main.cpp