我知道有一个帖子提出了类似的问题并且我读了它,但是 我仍然无法解决问题! 这是编译错误:
13:28:28 **** Rebuild of configuration Debug for project test2 ****
Info: Internal Builder is used for build
g++ "-IC:\\MinGW\\tbb\\tbb43_20150611oss\\include" -O0 -g3 -Wall -c -fmessage-length=0 -ltbb -std=c++11 -o "src\\test2.o" "..\\src\\test2.cpp"
g++ "-IC:\\MinGW\\tbb\\tbb43_20150611oss\\include" -O0 -g3 -Wall -c -fmessage-length=0 -ltbb -std=c++11 -o "src\\SnipSequence.o" "..\\src\\SnipSequence.cpp"
g++ "-LC:\\MinGW\\tbb\\tbb43_20150611oss\\lib" -o test2 "src\\test2.o" "src\\SnipSequence.o"
src\SnipSequence.o: In function `run':
C:/MinGW/tbb/tbb43_20150611oss/include/tbb/parallel_for.h:90: undefined reference to `tbb::task_group_context::~task_group_context()'
C:/MinGW/tbb/tbb43_20150611oss/include/tbb/parallel_for.h:90: undefined reference to `tbb::task_group_context::~task_group_context()'
src\SnipSequence.o: In function `ZN3tbb18task_group_contextC1ENS0_9kind_typeEj':
C:/MinGW/tbb/tbb43_20150611oss/include/tbb/task.h:450: undefined reference to `tbb::task_group_context::init()'
src\SnipSequence.o: In function `ZN3tbb4taskC2Ev':
C:/MinGW/tbb/tbb43_20150611oss/include/tbb/task.h:553: undefined reference to `vtable for tbb::task'
src\SnipSequence.o: In function `ZN3tbb4taskD2Ev':
C:/MinGW/tbb/tbb43_20150611oss/include/tbb/task.h:557: undefined reference to `vtable for tbb::task'
src\SnipSequence.o: In function `ZnwjRKN3tbb8internal32allocate_root_with_context_proxyE':
C:/MinGW/tbb/tbb43_20150611oss/include/tbb/task.h:998: undefined reference to `tbb::internal::allocate_root_with_context_proxy::allocate(unsigned int) const'
src\SnipSequence.o: In function `ZdlPvRKN3tbb8internal32allocate_root_with_context_proxyE':
C:/MinGW/tbb/tbb43_20150611oss/include/tbb/task.h:1002: undefined reference to `tbb::internal::allocate_root_with_context_proxy::free(tbb::task&) const'
src\SnipSequence.o: In function `ZnwjRKN3tbb8internal27allocate_continuation_proxyE':
C:/MinGW/tbb/tbb43_20150611oss/include/tbb/task.h:1007: undefined reference to `tbb::internal::allocate_continuation_proxy::allocate(unsigned int) const'
src\SnipSequence.o: In function `ZdlPvRKN3tbb8internal27allocate_continuation_proxyE':
C:/MinGW/tbb/tbb43_20150611oss/include/tbb/task.h:1011: undefined reference to `tbb::internal::allocate_continuation_proxy::free(tbb::task&) const'
src\SnipSequence.o: In function `ZN3tbb10interface78internal16allocate_siblingEPNS_4taskEj':
C:/MinGW/tbb/tbb43_20150611oss/include/tbb/parallel_for.h:120: undefined reference to `tbb::internal::allocate_child_proxy::allocate(unsigned int) const'
src\SnipSequence.o:SnipSequence.cpp:(.rdata$_ZTVN3tbb10interface78internal9flag_taskE[__ZTVN3tbb10interface78internal9flag_taskE]+0x14): undefined reference to `tbb::task::note_affinity(unsigned short)'
collect2.exe: error: ld returned 1 exit status
我在链接器部分和eclispe的include部分尝试过很多东西。我试图改变-ltbb和-std = c ++ 11的顺序。我仍然无法编译。我相信还有其他人有样本问题。
我无法解决我的问题:stackoverflow question/answer
答案 0 :(得分:0)
Ok首先在目录中安装MSYS2的副本。在此处找到:https://msys2.github.io/
安装后打开MSYS2的提示并执行以下行: pacman -S mingw-w64-i686-gcc mingw-w64-i686-make mingw-w64-i686-intel-tbb
然后在MSYS目录文件中搜索gcc.exe并将其添加到系统路径中。
在eclispe中,在项目属性的-L选项中添加C:\ msys64 \ mingw64 \ lib,在-l选项中添加tbb,并在-I选项中添加C:\ msys64 \ mingw64 \ include。
在编译器标志和Voila中添加-std = c ++ 11,如果是,则在索引器中添加 想要摆脱只在Eclipse中显示的某些错误。瞧!