![](/img/trans.png)
[英]Some headers-only files in my project cannot include “SFML/Graphics.hpp” using CMake and Vscode
[英].hpp files not running in vscode
我试图在 vscode 中创建一个 .hpp 文件,但是当我尝试运行它时,我被告知它与我的系统不兼容。 但是,我可以很好地使用和运行 .cpp 文件。
TreeNode.exe 与您运行的 Windows 版本不兼容。 检查您计算机的系统信息,然后联系软件发行商。
class TreeNode{
public:
char value;
char left;
char right;
TreeNode(char val){
value = val;
}
};
*.hpp
是没有main()
函数的头文件,而包含main()
函数的*.cpp
文件用于通过( gcc
或clang
)编译。 要测试您的*.hpp
文件,您需要将其包含在*.cpp
文件中。
#include "./my_header_file.hpp"
永远记住, main()
是你程序的入口,它应该存在。
另外,我认为您的类TreeNode
不正确,而不是:
char left;
char right;
它应该是:
TreeNode *left; // allocate on heap-memory using `new` operator
TreeNode *right; // allocate on heap-memory using `new` operator
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.