Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/157.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Netbeans C/C++;链接器问题 在Linux上的NETBeaS 6.9,我试图编译我的C++代码。 它由两个CPP文件组成——main.CPP,后来我在项目中添加了Tree.CPP和Tree.h,但链接器显然忽略了这一事实,当我使用树单元中的某些内容时,在main.CPP中抛出了一个“未定义的引用错误”_C++_Linux_Netbeans_Linker - Fatal编程技术网

Netbeans C/C++;链接器问题 在Linux上的NETBeaS 6.9,我试图编译我的C++代码。 它由两个CPP文件组成——main.CPP,后来我在项目中添加了Tree.CPP和Tree.h,但链接器显然忽略了这一事实,当我使用树单元中的某些内容时,在main.CPP中抛出了一个“未定义的引用错误”

Netbeans C/C++;链接器问题 在Linux上的NETBeaS 6.9,我试图编译我的C++代码。 它由两个CPP文件组成——main.CPP,后来我在项目中添加了Tree.CPP和Tree.h,但链接器显然忽略了这一事实,当我使用树单元中的某些内容时,在main.CPP中抛出了一个“未定义的引用错误”,c++,linux,netbeans,linker,C++,Linux,Netbeans,Linker,您是否知道如何将CPP文件正确添加到项目中,以使其成功链接 谢谢 您需要将Tree.cpp添加到项目的构建配置中;此外,您还需要在“搜索文件”构建部分中添加到Tree.h的路径 右键单击项目并选择“属性”,然后转到C++编译器部分。在“包含目录”中,将路径添加到Tree.h。现在,再次右键单击项目并选择“添加现有项”,然后选择“Tree.cpp”。最后清理和重建,你的项目应该建得很好

您是否知道如何将CPP文件正确添加到项目中,以使其成功链接


谢谢

您需要将Tree.cpp添加到项目的构建配置中;此外,您还需要在“搜索文件”构建部分中添加到Tree.h的路径

右键单击项目并选择“属性”,然后转到C++编译器部分。在“包含目录”中,将路径添加到Tree.h。现在,再次右键单击项目并选择“添加现有项”,然后选择“Tree.cpp”。最后清理和重建,你的项目应该建得很好