[英]How do I tell Visual Studio that my header should be C++ and not C?
I have a C++ project, and the main file with the main function is a .c
, but when I include my .h
that is supposed to be C++, I think I am getting errors because it thinks it is C. I have a C++ project, and the main file with the main function is a .c
, but when I include my .h
that is supposed to be C++, I think I am getting errors because it thinks it is C. How can I tell it that my header should be C++ and not C, like my main?我怎么能告诉它我的 header 应该是 C++ 而不是 C,就像我的主?
You cannot #include
C++ header in a C source file.您不能在 C 源文件中#include
C++ header。 A header is not compiled separately. A header 没有单独编译。 All that #include
does - it makes the compiler work as if the header was a part of the file. #include
所做的一切 - 它使编译器像 header 是文件的一部分一样工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.