I wrote a simple class:
c:\geometry\Point.h
c:\geometry\Point.cpp

I made a VS2005 project and added a Source File test.cpp which contains main(). In test.cpp, I #include "c:/geometry/Point.h"

When I build the project I get:

Unresolved external symbol "public: __thiscall Point::Point(double,double,double)" referenced in function _main.

However, if add Point.h to my Header Files and Point.cpp to my Source Files the error goes away. Why do I have to add these to the project? Can't I just use them by including them like I tried to?

Thanks,

David

Sorry for the silly question - I figured it out.

Turns out you only have to add the .ccp file to the project. When you #include "director/myclass.h", that declares the functions, but without the .cpp as part of the project, the function definitions are no where to be found!

David

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.