I have multiple static libraries created with Visual Studio and Visual C++
compiler.
I am also using a CxxTest for unit testing. I created tests in .h files and generated test runner file runner.cpp
.
Next thing I need to do is to compile that runner.cpp
file.
runner.cpp
uses one of the libraries, CommonLib.lib
. CommonLib.lib
doesn't have any aditional library dependencies.
CommonLib.lib
headers are in my CommonLib
project's directory.
I tried to compile runner.cpp
using next command:
g++ -o runner.exe runner.cpp -L../x64/Release -l:CommonLib.lib -I../CommonLib
-I../cxxtest-4.4
In Release
directory there is a CommonLib.lib
and headers are in a CommonLib
directory. cxxtest-4.4
directory contains CxxTest headers.
I am getting error:
undefined reference to `multiplyMatricesStandard(int**, int**, int, int, int**, int, int, int)
multiplyMatricesStandard
is a function that has declaration in a header file located in a CommonLib
directory. In same directory is also a cpp file that contains a definition for that function (I don't think cpp file's location really matters because I have created a static library).
I can't figure out why g++ can't see definition for a function.
Is there a problem if static library is not created with g++? If there is, how can i compile runner.cpp
file without having to create static libraries with g++?