cygwin g++ XnOpenNI。h:没有这样的文件或目录错误。

时间:2023-02-09 22:56:39

This is my first attempt to compile a main.cpp file with cygwin. The command I am using in cygwin is:

这是我第一次尝试编译一个main。cpp文件cygwin。我在cygwin中使用的命令是:

$ g++ main.cpp -o main

I am getting a series of errors like this:

我得到了一系列这样的错误:

main.cpp:26:22: error: XnOpenNI.h: No such file or directory
main.cpp:29:31: error: XnVSessionManager.h: No such file or directory
main.cpp:30:39: error: XnVMultiProcessFlowClient.h: No such file or directory
main.cpp:31:29: error: XnVWaveDetector.h: No such file or directory
In file included from main.cpp:33:
kbhit.h:4:24: error: XnPlatform.h: No such file or directory

My main.cpp looks like this

我的主。cpp是这样的

// General headers
#include <stdio.h>
// OpenNI headers
#include <XnOpenNI.h>
using namespace std; 
// NITE headers
#include <XnVSessionManager.h>
#include "XnVMultiProcessFlowClient.h"
#include <XnVWaveDetector.h>

Even thought I have these .h files in the same directory as main.cpp I do believe that the error is due to the fact that I need to somehow define a path.

甚至认为我有这些。h文件在同一个目录中作为main。cpp我相信错误是由于我需要定义一条路径。

Any suggestions? Thanks

有什么建议吗?谢谢

2 个解决方案

#1


1  

put them in quotes "" rather than <> if they are local, they are assumed to be in the system paths otherwise, alternatively

把它们放在引号中,而不是<>,如果它们是本地的,则假定它们位于系统路径中,反之亦然。

g++ main.cpp -o main -I *local_path* where *local_path* is your current directory

g++主要。cpp -o main -I *local_path* where *local_path*是当前目录。

#2


1  

If you have them in the some folder, can't you use

如果你把它们放在某个文件夹里,你就不能用。

#include "xxxx.h"  

instead of

而不是

#include <xxxx.h>

#1


1  

put them in quotes "" rather than <> if they are local, they are assumed to be in the system paths otherwise, alternatively

把它们放在引号中,而不是<>,如果它们是本地的,则假定它们位于系统路径中,反之亦然。

g++ main.cpp -o main -I *local_path* where *local_path* is your current directory

g++主要。cpp -o main -I *local_path* where *local_path*是当前目录。

#2


1  

If you have them in the some folder, can't you use

如果你把它们放在某个文件夹里,你就不能用。

#include "xxxx.h"  

instead of

而不是

#include <xxxx.h>