How do I store object files as a library??
-
Hi there. I downloaded a matrix arithmetic library, Newmat10, and are struggling to get it to work. The author says that it would work fine with MS Visual Studio 2003, which is what I am using. The library consists of a lot of cpp files which have to be compiled. This part I get right. Then all I have to do is include the main header file >> newmatap.h, in the project where I want to use the matrix functions. So I include the header file in the project where I want to use the functions and it compiles. But the moment I use one of the functions of the library, I get a lot of error messages that looks like this: TestNewMat.obj : error LNK2019: unresolved external symbol "public: __thiscall Matrix::Matrix(int,int)" (??0Matrix@@QAE@HH@Z) referenced in function _main. What am I doing wrong? The author said something about it being best to store the resulting object files ( the ones you get when you compile the source files of the library) as a library. How does that work? Any help would be appreciated!! Thank you.
-
Hi there. I downloaded a matrix arithmetic library, Newmat10, and are struggling to get it to work. The author says that it would work fine with MS Visual Studio 2003, which is what I am using. The library consists of a lot of cpp files which have to be compiled. This part I get right. Then all I have to do is include the main header file >> newmatap.h, in the project where I want to use the matrix functions. So I include the header file in the project where I want to use the functions and it compiles. But the moment I use one of the functions of the library, I get a lot of error messages that looks like this: TestNewMat.obj : error LNK2019: unresolved external symbol "public: __thiscall Matrix::Matrix(int,int)" (??0Matrix@@QAE@HH@Z) referenced in function _main. What am I doing wrong? The author said something about it being best to store the resulting object files ( the ones you get when you compile the source files of the library) as a library. How does that work? Any help would be appreciated!! Thank you.
BenPage wrote: The library consists of a lot of cpp files which have to be compiled Do you compile them as a separate library ? Or do you want to add all the files to your project ? BenPage wrote: What am I doing wrong? It's normal that it doesn't work: you have just included the header files in your project thus the linker doesn't find the 'code' for the functions. You have two solutions: either include the .cpp to your project also OR, if you want to use that in a separate library, go in the project settings (don't remember exactly where) and you have somewhere to tell that your project uses the library you compiled (don't forget to copy it to your project folder). Hope this helps