Home > Mobile >  .hpp files not running in vscode
.hpp files not running in vscode

Time:05-26

I was trying to create a .hpp file in vscode, but when I tried running it I was told it was not compatible with my system. However, I am able to use and run .cpp files just fine.

TreeNode.exe is not compatible with the version of Windows you're running. Check your computer's system information and then contact the software publisher.

class TreeNode{
    public:
        char value;
        char left;
        char right;
        TreeNode(char val){
                value = val;
                
        }
};

CodePudding user response:

*.hpp are the header files without main() function, whereas *.cpp files containing main() function are for compiling through (gcc or clang). To test out your *.hpp files you need to include it in *.cpp file.

#include "./my_header_file.hpp"

Always remember, main() is the entry of your program, it should exist.


Also, I think your class TreeNode isn't correct instead of:

char left;
char right;

It should be:

TreeNode *left; // allocate on heap-memory using `new` operator
TreeNode *right; // allocate on heap-memory using `new` operator
  • Related