Use visual studio to write a c program. The c declaration is placed in the a.h file, and the implementation is placed in a.cpp. Why can you use the class implemented in a.cpp by referencing a.h in main.cpp, while referencing a.cpp An error will be reported.
I don’t understand the rules very well. Can someone explain it to me?
PHPz2017-05-31 10:41:52
First of all, the former means that you want to use this class. Considering that during the compilation process, you can use this class and function as long as there is a declaration of the class and function. When linking, the linker will look for the definition of the class and function in other files. In the latter, you do not have a declaration of the class implemented by a.cpp. The compiler does not know this class, so a compilation error occurs.
世界只因有你2017-05-31 10:41:52
It’s written more clearly here, you can understand it
http://blog.csdn.net/praker/a...