I keep getting an ununderstood "unresolved externals error from C++ from Visual Studio 2013. Thank you very much for your help so far. I have reduced the code even more to the following form (but the Problem persists):
main.cpp:
#include "Fibonacci.h"
using namespace std;
int main(void){
int RandInteger = 3;
Fibonacci Fib(RandInteger);
}
Fibonacci.h
class Fibonacci{
public:
Fibonacci(int n=0);
protected:
int m_n0, m_n1, m_n;
};
Fibonacci.cpp:
#include "Fibonacci.h"
Fibonacci::Fibonacci(int n){
m_n0 = 0;
m_n1 = 1;
m_n = n;
}
This code produces the following error in Visual Studio 2013:
Error 2 error LNK1120: 1 unresolved externals C:\Dropbox\todo\c++\Exam\Ex2\doesn't work\Exercise 2\fibo1\Fibo1\Debug\Fibo1.exe Fibo1 Error 1 error LNK2019: unresolved external symbol "public: __thiscall Fibonacci::Fibonacci(int)" (??0Fibonacci@@QAE@H@Z) referenced in function _main C:\Dropbox\todo\c++\Exam\Ex2\doesn't work\Exercise 2\fibo1\Fibo1\main.obj Fibo1
I persists, but as soon as I replace the line in main.cpp with
Fibonacci Fib();
i.e. I do not pass the integer to the constructor, everything works (well it compiles an does nothing as expected).
Thanks for your help! I am really still stuck.