需要帮助使TBB正常工作吗? [英] Need help getting intel TBB working?

查看:94
本文介绍了需要帮助使TBB正常工作吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Mac OS sierra设备上运行brew install tbb.运行此命令后,我应该可以将#include包含到我的c ++项目中,对吗?由于某些原因,在我编译这些文件时找不到.帮助将不胜感激

I ran brew install tbb on my mac os sierra device. After running this i should be able to include #include into my c++ projects right? For some reason when I compile these files are not found. Help would be appreciated

推荐答案

几件事...

在安装任何 homebrew 软件包之前,请养成检查可用选项的习惯,而不仅仅是接受默认选项.它通常可以让您深入了解您不知道的可用功能.因此,对于 tbb :

Before you install any homebrew packages, get in the habit of checking the available options rather than just accepting the default ones. It often gives you insights into features that are available which you are unaware of. So, for tbb:

brew options tbb

输出

--c++11
    Build using C++11 mode

因此,可能值得使用:

brew install tbb --c++11

brew reinstall tbb --c++11

首先自己查找包含文件和库

如果要包含头文件,请尝试先使用 find 查找自己的头文件:

find /usr /opt concurrent_queue.h

输出

/usr/local/Cellar/tbb/4.4-20160916/include/tbb/concurrent_queue.h

所以我的系统上只有一个 concurrent_queue.h .现在我们需要告诉编译器如何找到它.如果您查看/usr/local/include ,这是 homebrew 放置标题的位置,您将看到以下内容:

So there is only one concurrent_queue.h on my system. Now we need to tell the compiler how to find it. If you look in /usr/local/include, which is where homebrew puts headers, you will see this:

ls -l /usr/local/include | grep tbb
lrwxr-xr-x    1 mark  admin    38  5 Oct 09:10 tbb -> ../Cellar/tbb/4.4-20160916/include/tbb

因此, tbb 标头位于/usr/local/include/tbb 中(这是 homebrew 的地窖的符号链接),因此您需要确保编译器正在查找/usr/local/include .

So, the tbb headers are in /usr/local/include/tbb (which is a symlink to homebrew's Cellar), so you need to make sure your compiler is looking in /usr/local/include.

g++-6 -I/usr/local/include ...

请记住,您可以使用 -v 来检查编译器的位置,如下所示:

Remember you can check where your compiler is looking by using -v, like this:

g++-6 -v ...

一旦您帮助编译器找到了头文件(#includes),您将需要帮助链接程序找到这些库,因此您的命令将变为:

Once you helped the compiler find the header files (#includes), you will then need to help the linker find the libraries, so your command will become:

g++-6 -I/usr/local/include program.cpp -o program -L /usr/local/lib -ltbb

这篇关于需要帮助使TBB正常工作吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆