just do a #include "abc.cpp" in your original program (xyz.cpp) i think, as long as you take out your int main from abc.cpp?
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
If you have declared classes then it is usually a good idea to use a .h file and separate out the definition and declaration of the class. As far as the error is concerned can you post some code here? the main function and abc.cpp will do.
Agni
Practically a Master Poster
655 posts since Dec 2007
Reputation Points: 431
Solved Threads: 116
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
Sorry can't help mate. I only have dev-cpp here.
Good luck.
iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
First this is to learn about using Code Tags [CODE] option on your reply box. Read more here .
Your file is probably not getting included because of using
#include <black_..>
. If it is in the same directory as the main file use
#include "black.."
.
Even then you will get a linker error if you compile n link both the files. Try compiling only main.cpp or put the function in the main file itself.
Agni
Practically a Master Poster
655 posts since Dec 2007
Reputation Points: 431
Solved Threads: 116
Thanks - I can put the entire function in my project, however, I want to reuse that file over and over again to call up as an include file in multiple projects withotu having to paste the function in. There must be a way to perform a function call, that exists in another file, into a different file without having to reinvent or paste the wheel everytime. Consider my one file an operator I want to call up anywhere.
Did you try the other stuff mentioned in my post? the last part was just an alternative. Did you try include using the "" and compiling only main.cpp?
Agni
Practically a Master Poster
655 posts since Dec 2007
Reputation Points: 431
Solved Threads: 116