0

I am having trouble dealing with multiple C++ files in Visual Studio Code (I am a Linux user). Everything is fine, but when I include a header (class definition) file (which includes another .cpp with the class methods and constructors), it gives a strange error "undefined reference to Class_name::Class_name()".

Running the exact same code in Code::Blocks in an empty project is working perfectly fine. If I am using separate files it isn't working, so I guess the problem is how to link the files in VS Code? Is there a way this can be solved?

Seymour B
  • 123
  • 1
  • 5
  • ***it gives a strange error "undefined reference to Class_name::Class_name()".*** That is not strange at all. This is a very common error. You either are not building the .cpp file as part of your project or you did not define the constructor that the error references. I think you just need to add the .cpp file to your project. Although I don't use VS code. I use Visual Studio. – drescherjm Apr 12 '19 at 18:26
  • Possible duplicate of [What is an undefined reference/unresolved external symbol error and how do I fix it?](https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) – Alan Birtles Apr 12 '19 at 19:52

0 Answers0