I have a C file, which uses multiple lib files.I am trying to compile the file in the following way:
gcc -o myprogram main.c list.lib filelib.lib
However, when trying to compile I get a bunch of undefined reference
errors of all the lib
functions that I'm using.
I came accross a solution on the internet and tried the following:
gcc -o myprogram main.c -l list -l filelib
Now I get the following errors:
cannot find -llistcannot fint -lfilelib
What am I doing wrong?
Edit:Both the libs were originally created using Visual Studio 2019, Release mode x64.I am using Windows 10, 64 bits architecture.In the folder I'm running gcc from I have the following files:
main.clist.lib (copied from VS)list.h (copied form VS)filelib.lib (copied from VS)filelib.h (copied from VS)
In my lib code in VS I made sure the functions have c-linkage:
#ifdef __cplusplus#define C_LINKAGE extern "C"#else#define C_LINKAGE#endif
(each declared function in both the libs starts with the C_LINKAGE macro)