2017-02-24 449 views
0

我得到当我使用Cygwin在 “Makefile文件” 这个错误:Cygwin:“boost/filesystem.hpp:没有这样的文件或目录编译终止。”

"boost/filesystem.hpp: No such file or directory compilation terminated."

这是一切的里面的 “Makefile” 文件:

mnisten: src/main.cpp g++ -Wall -O2 -lboost_filesystem-mt -std=c++0x -o mnisten src/main.cpp

而且里面的“ main.cpp“文件,这是错误消息所指的代码行:

#include <boost/filesystem.hpp>

首先,我尝试在“src”文件夹内放置“boost”文件夹(包含“filesystem.hpp”),但错误消息未更改,我仍收到相同的错误消息。

然后,我改变该“包括”代码内“的main.cpp”到: #include <filesystem.hpp>

我还复制了“filesystem.hpp”文件进入“SRC”文件夹的根,并且令人惊讶这个工作。我有一个新的错误,但我通过了“包含”部分。

我发现它非常令人困惑,它在文件位于文件夹中时遇到错误,但当文件位于“src”文件夹的根目录中时,它会发生错误。

当文件位于“boost”文件夹中时,我如何才能使其正常工作?

(我下载了“filesystem.hpp”,因为它是不包括在内)

+0

类似你安装了Cygwin包'libboost-devel'包括filesystem.hpp? – matzeri

+0

工作,谢谢。现在我得到了一个关于“opencv/cv.hpp”的错误,你碰巧知道包含“cv.hpp”的包的名字吗? – Tob237

回答

1

要找到cygwin的包,其中包含一个给定的文件,你可以使用cygcheck -p

$ cygcheck -p boost/filesystem.hpp 
Found 6 matches for boost/filesystem.hpp 
libboost-devel-1.60.0-1 - libboost-devel: Boost C++ libraries (installed binaries and support files) 
libboost-devel-1.60.0-2 - libboost-devel: Boost C++ libraries (installed binaries and support files) 
mingw64-i686-boost-1.60.0-1 - mingw64-i686-boost: Boost C++ libraries for Win32 toolchain (installed binaries and support files) 
mingw64-i686-boost-1.60.0-2 - mingw64-i686-boost: Boost C++ libraries for Win32 toolchain (installed binaries and support files) 
mingw64-x86_64-boost-1.60.0-1 - mingw64-x86_64-boost: Boost C++ libraries for Win64 toolchain (installed binaries and support files) 
mingw64-x86_64-boost-1.60.0-2 - mingw64-x86_64-boost: Boost C++ libraries for Win64 toolchain (installed binaries and support files) 

,所以你需要因为您不是针对mingw64进行交叉编译,请安装libboost-devel

$ cygcheck -p opencv/cv.hpp 
Found 1 matches for opencv/cv.hpp 
libopencv-devel-2.4.11-1 - libopencv-devel: Real-time computer vision library (development) (installed binaries and support files) 
相关问题