"No such file or directory" C++标头问题

"No such file or directory" C++ header issue

本文关键字:问题 C++ or No such file directory      更新时间:2023-10-16

我正在处理一个有三个 cpp 文件和两个头文件的项目

我的所有文件都在同一个文件夹中。

在过去的几天里,我一直在尝试将头文件与 cpp 文件链接起来,但我对此非常挣扎。 首先,我尝试在"构建选项"中添加文件>"搜索目录">"编译器>添加" "生成选项"中的设置图像

我已确保我的头文件正确键入:

Vectorfunc.h

#include <vector>
#ifndef VECTORFUNC_H_INCLUDED
#define VECTORFUNC_H_INCLUDED
//my vector functions declaration
#endif // VECTORFUNC_H_INCLUDED

Vectorfunc.cpp

#include <vector>
#include "vectorfunc.h"
#include <iostream>
//my function definitions 

跟踪卡尔曼.h

#ifndef TRACKKALMAN_H_INCLUDED
#define TRACKKALMAN_H_INCLUDED
void TrackKalman();
#endif // TRACKKALMAN_H_INCLUDED

跟踪卡尔曼.cpp

#include <valarray>
#include <vector>
#include <iostream>
#include "vectorfunc.h"
//function definition of TrackKalman()

主.cpp

#include <iostream>
#include <fstream>
#include <vector>
#include <cmath>
#include "TrackKalman.h"
//main function

尽管如此,我仍然在我的编译器中收到错误:

||=== Build: Debug in RadarScanner (compiler: GNU GCC Compiler) ===|
filesRadarScannerTrackKalman.cpp -o objDebugTrackKalman.o||No such file or directory|
filesRadarScannermain.cpp -o objDebugmain.o              ||No such file or directory|
||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 2 second(s)) ===|

我正在使用 GNU GCC 编译器

任何帮助将不胜感激。我似乎无法解决问题,我绝对不想将整个程序放在一个文件中。

我认为你错过了

#include "TrackKalman.h”

作为TrackKalman的第一行.cpp