Compiling .cpp files separately


I would like to use a C++ library to deal with sparse matrices. One library that I came across is called ALGLIB. When I downloaded and unzipped the file, there were a bunch of .cpp and .h files. I'm using Visual Studios 2015 on a Windows 10 computer. The instructions were given as such...

"Adding ALGLIB to your project is easy - just pick packages you need and... add them to your project! Under most used compilers (GCC, MSVC) it will work without any additional settings. In other cases you will need to define several preprocessor definitions (this topic will be detailed below), but everything will still be simple.

By "adding to your project" we mean that you should a) compile .cpp files with the rest of your project, and b) include .h files you need. Do not include .cpp files - these files must be compiled separately, not as part of some larger source file. The only files you should include are .h files, stored in the /src folder of the ALGLIB distribution."

For part (b), I went to "project -> properties -> VC++ directories -> Include Directories" and pasted the link to the .h folders. So I think that's fine. But I'm not sure how to compile the .cpp files separately.

Please help. Thanks.

VS2015 has some kind of solution explorer, I think. If you right click on it, with your project open, you can choose to add existing files to your project. Add the *.cpp files you want.

Do not include .cpp files
I suspect means
do not #include .cpp files

But I'm not sure how to compile the .cpp files separately.

Every cpp file is compiled separately, always. It's how C++ operates.
Last edited on
Registered users can post here. Sign in or register to post.