2013-12-15 4 views
0

Я пытаюсь скомпилировать программу с OpenCv с поддержкой CUDA на linux. Я создал Makefile:Скомпилировать OpenCv с поддержкой CUDA на linux

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, г ++ 4.4

той же программа отлично в Visual Studio 2012 работает. Есть ли способ скомпилировать это на Linux?

ответ

1

Кажется, что вы используете версию OpenCV 2.4. Вы не можете использовать заголовки OpenCV в коде CUDA. Чтобы использовать OpenCV в проекте CUDA, разделите файл на два файла: .cpp и .cu и поместите весь код CUDA в файл .cu и весь код OpenCV в файл .cpp.

+0

Есть ли возможность поместить код в один файл? Visual studio позволяет это: p – John

+0

В мастер-ветке вы можете использовать заголовки OpenCV в коде CUDA. Но мастер-ветвь еще не стабильна. – jet47

Смежные вопросы