forum.alglib.net
http://forum.alglib.net/

Including .cpp files.
http://forum.alglib.net/viewtopic.php?f=2&t=774
Page 1 of 1

Author:  Prog [ Tue Feb 19, 2013 2:30 pm ]
Post subject:  Including .cpp files.

Hello.
I use AlgLib at first. I have a problem: LNK2019: unresolved external symbol ...

There are a lot of similar topics in this disuss. This problem is resolved by including *.cpp file, not .h one. But it's said in manual "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."

Doesn't work
Code:
#include "ap.h"
alglib::integer_2d_array c("[[1,2,3],[9,9,9]]");
void main () {
}


Works
Code:
#include "ap.cpp"
alglib::integer_2d_array c("[[1,2,3],[9,9,9]]");
void main () {
}


May be I don't understand Manual correctly.

Author:  Eden [ Tue Feb 19, 2013 4:37 pm ]
Post subject:  Re: Including .cpp files.

Hello,

i think, that the problem is in linking. Are you sure, that .cpp(all for sure) files are compiled and linked with your source file?
What compiler and commands(for compiling) do you use? Can you post it?

Author:  Prog [ Wed Feb 20, 2013 4:40 am ]
Post subject:  Re: Including .cpp files.

Eden wrote:
Hello,

i think, that the problem is in linking. Are you sure, that .cpp(all for sure) files are compiled and linked with your source file?
What compiler and commands(for compiling) do you use? Can you post it?


I'm also beginner at c++ programming. I use MVSC++ 2010 Express. And I didn't know that I have to add .cpp files in the left side list besides project folder.

Thank you very much. It's working now.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/