..
fatal error CL/cl.h No such file or directory
开发环境
Ubuntu 18.04.5 LTS
g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Boost 1_65_0
实例
#include <algorithm> //std::lower_bound / std::uppper_bound
#include <boost/compute/algorithm/upper_bound.hpp>
#include <boost/compute/algorithm/lower_bound.hpp>
int main() {
int myints[] = {10,20,30,30,20,10,10,20};
std::vector<int> v(myints,myints+8); // 10 20 30 30 20 10 10 20
std::sort (v.begin(), v.end()); // 10 10 10 20 20 20 30 30
std::vector<int>::iterator low,up;
low=std::lower_bound (v.begin(), v.end(), 20); // ^
up= std::upper_bound (v.begin(), v.end(), 20); // ^
std::cout << "lower_bound at position " << (low- v.begin()) << '\n';
std::cout << "upper_bound at position " << (up - v.begin()) << '\n';
low=lower_bound (v.begin(), v.end(), 20); // ^
up= upper_bound (v.begin(), v.end(), 20); // ^
std::cout << "boost lower_bound at position " << (low- v.begin()) << '\n';
std::cout << "boost upper_bound at position " << (up - v.begin()) << '\n';
}
编译提示: fatal error CL/cl.h No such file or directory
。
解决一下
在 #include <boost/compute/cl.hpp>
下找到这段代码1
#if defined(__APPLE__)
#include <OpenCL/cl.h>
#else
#include <CL/cl.h>
#endif
跟 opencl
相关 2.
执行命令
sudo apt-get install opencl-headers
-
The Boost Compute library provides a C++ interface to multi-core CPU and GPGPU computing platforms based on OpenCL. ↩