我正在尝试使用OpenCv编译程序,并在Linux上支持CUDA。我创建了Makefile:
filtry_gpu: filtry_gpu.cu
nvcc -lopencv_highgui -lopencv_core -I/opt/opencv/include -L/opt/opencv/lib -Xcompiler \-fopenmp -Xcompiler \-Wall -Xlinker \-lgomp filtry_gpu.cu -o filtry_gpu
clean:
rm -f *.o
但我收到了错误:
/usr/lib/gcc/x86_64-linux-gnu/4.3.5/include/emmintrin.h(218): error: argument of type "__v2di" is incompatible with parameter of type "__attribute((vector_size(16))) long"
/usr/lib/gcc/x86_64-linux-gnu/4.3.5/include/emmintrin.h(225): error: argument of type "__v2di" is incompatible with parameter of type "__attribute((vector_size(16))) long"
/usr/lib/gcc/x86_64-linux-gnu/4.3.5/include/emmintrin.h(711): error: argument of type "__v2di" is incompatible with parameter of type "__attribute((vector_size(16))) long"
/usr/lib/gcc/x86_64-linux-gnu/4.3.5/include/emmintrin.h(717): error: argument of type "__v2di" is incompatible with parameter of type "__attribute((vector_size(16))) long"
/usr/lib/gcc/x86_64-linux-gnu/4.3.5/include/emmintrin.h(964): error: argument of type "__v2di" is incompatible with parameter of type "__attribute((vector_size(16))) long"
/usr/lib/gcc/x86_64-linux-gnu/4.3.5/include/emmintrin.h(964): error: argument of type "__v2di" is incompatible with parameter of type "__attribute((vector_size(16))) long"
/usr/lib/gcc/x86_64-linux-gnu/4.3.5/include/emmintrin.h(988): error: argument of type "__v2di" is incompatible with parameter of type "__attribute((vector_size(16))) long"
/usr/lib/gcc/x86_64-linux-gnu/4.3.5/include/emmintrin.h(988): error: argument of type "__v2di" is incompatible with parameter of type "__attribute((vector_size(16))) long"
/usr/lib/gcc/x86_64-linux-gnu/4.3.5/include/emmintrin.h(1012): error: argument of type "__v2di" is incompatible with parameter of type "__attribute((vector_size(16))) long"
/usr/lib/gcc/x86_64-linux-gnu/4.3.5/include/emmintrin.h(1012): error: argument of type "__v2di" is incompatible with parameter of type "__attribute((vector_size(16))) long"
/usr/lib/gcc/x86_64-linux-gnu/4.3.5/include/emmintrin.h(1060): error: argument of type "__v2di" is incompatible with parameter of type "__attribute((vector_size(16))) long"
/usr/lib/gcc/x86_64-linux-gnu/4.3.5/include/emmintrin.h(1060): error: argument of type "__v2di" is incompatible with parameter of type "__attribute((vector_size(16))) long"
/usr/lib/gcc/x86_64-linux-gnu/4.3.5/include/emmintrin.h(1132): error: argument of type "__v2di" is incompatible with parameter of type "__attribute((vector_size(16))) long"
/usr/lib/gcc/x86_64-linux-gnu/4.3.5/include/emmintrin.h(1181): error: argument of type "__v2di" is incompatible with parameter of type "__attribute((vector_size(16))) long"
/usr/lib/gcc/x86_64-linux-gnu/4.3.5/include/emmintrin.h(1199): error: argument of type "__v2di" is incompatible with parameter of type "__attribute((vector_size(16))) long"
/usr/lib/gcc/x86_64-linux-gnu/4.3.5/include/emmintrin.h(1199): error: argument of type "__v2di" is incompatible with parameter of type "__attribute((vector_size(16))) long"
/usr/lib/gcc/x86_64-linux-gnu/4.3.5/include/emmintrin.h(1229): error: argument of type "__v2di" is incompatible with parameter of type "__attribute((vector_size(16))) long"
/usr/lib/gcc/x86_64-linux-gnu/4.3.5/include/emmintrin.h(1229): error: argument of type "__v2di" is incompatible with parameter of type "__attribute((vector_size(16))) long"
/usr/lib/gcc/x86_64-linux-gnu/4.3.5/include/emmintrin.h(1235): error: argument of type "__v2di" is incompatible with parameter of type "__attribute((vector_size(16))) long"
/usr/lib/gcc/x86_64-linux-gnu/4.3.5/include/emmintrin.h(1235): error: argument of type "__v2di" is incompatible with parameter of type "__attribute((vector_size(16))) long"
/usr/lib/gcc/x86_64-linux-gnu/4.3.5/include/emmintrin.h(1241): error: argument of type "__v2di" is incompatible with parameter of type "__attribute((vector_size(16))) long"
/usr/lib/gcc/x86_64-linux-gnu/4.3.5/include/emmintrin.h(1241): error: argument of type "__v2di" is incompatible with parameter of type "__attribute((vector_size(16))) long"
/usr/lib/gcc/x86_64-linux-gnu/4.3.5/include/emmintrin.h(1247): error: argument of type "__v2di" is incompatible with parameter of type "__attribute((vector_size(16))) long"
/usr/lib/gcc/x86_64-linux-gnu/4.3.5/include/emmintrin.h(1247): error: argument of type "__v2di" is incompatible with parameter of type "__attribute((vector_size(16))) long"
/usr/lib/gcc/x86_64-linux-gnu/4.3.5/include/emmintrin.h(1253): error: argument of type "__v2di" is incompatible with parameter of type "__attribute((vector_size(16))) long"
/usr/lib/gcc/x86_64-linux-gnu/4.3.5/include/emmintrin.h(1253): error: argument of type "__v2di" is incompatible with parameter of type "__attribute((vector_size(16))) long"
/usr/lib/gcc/x86_64-linux-gnu/4.3.5/include/emmintrin.h(1426): error: argument of type "__v2di *" is incompatible with parameter of type "__attribute((vector_size(16))) long *"
/usr/lib/gcc/x86_64-linux-gnu/4.3.5/include/emmintrin.h(1426): error: argument of type "__v2di" is incompatible with parameter of type "__attribute((vector_size(16))) long"
我的openCV版本是4.3.7,CUDA 4.0,g ++ 4.4
相同的程序在visual Studio 2012中运行良好。有没有办法在linux上编译它?
答案 0 :(得分:1)
好像你正在使用OpenCV 2.4版本。您不能在CUDA代码中使用OpenCV标头。要在CUDA项目中使用OpenCV,请将文件拆分为两个文件:.cpp
和.cu
,并将所有CUDA代码放入.cu
文件,将所有OpenCV代码放入.cpp
文件。< / p>