g++ 컴파일cpp 프로그램/usr/bin/ld: cannot find-lopencvcudabgsegm....등의 문제

2384 단어 gcc/g++
g++ mtcnn 실행opencv.cpp -I/usr/local/opencv3.4.0/include -shared -o libmtcnndetection2.so -std=c++11 -fPIC pkg-config opencv --cflags --libs 다음 문제 발생:/usr/bin/ld: cannot find-lopencvcudabgsegm/usr/bin/ld: cannot find -lopencv_cudaobjdetect/usr/bin/ld: cannot find -lopencv_cudastereo/usr/bin/ld: cannot find -lopencv_dnn/usr/bin/ld: cannot find -lopencv_ml/usr/bin/ld: cannot find -lopencv_shape/usr/bin/ld: cannot find -lopencv_stitching/usr/bin/ld: cannot find -lopencv_cudafeatures2d/usr/bin/ld: cannot find -lopencv_superres/usr/bin/ld: cannot find -lopencv_cudacodec/usr/bin/ld: cannot find -lopencv_videostab/usr/bin/ld: cannot find -lopencv_cudaoptflow/usr/bin/ld: cannot find -lopencv_cudalegacy/usr/bin/ld: cannot find -lopencv_calib3d/usr/bin/ld: cannot find -lopencv_features2d/usr/bin/ld: cannot find -lopencv_highgui/usr/bin/ld: cannot find -lopencv_videoio/usr/bin/ld: cannot find -lopencv_photo/usr/bin/ld: cannot find -lopencv_imgcodecs/usr/bin/ld: cannot find -lopencv_cudawarping/usr/bin/ld: cannot find -lopencv_cudaimgproc/usr/bin/ld: cannot find -lopencv_cudafilters/usr/bin/ld: cannot find -lopencv_video/usr/bin/ld: cannot find -lopencv_objdetect/usr/bin/ld: cannot find -lopencv_imgproc/usr/bin/ld: cannot find -lopencv_flann/usr/bin/ld: cannot find -lopencv_cudaarithm/usr/bin/ld: cannot find -lopencv_core/usr/bin/ld: cannot find -lopencv_cudev collect2: error: ld returned 1 exit status
첫 번째 해결:sudo apt-get install libopencv-dev를 실행하여 비cuda 문제 해결(/usr/bin/ld: cannot find-lopencv dnn) 제외/usr/bin/ld: cannot find open-lcvcudabgsegm/usr/bin/ld: cannot find -lopencv_cudaobjdetect/usr/bin/ld: cannot find -lopencv_cudastereo/usr/bin/ld: cannot find -lopencv_dnn/usr/bin/ld: cannot find -lopencv_cudafeatures2d/usr/bin/ld: cannot find -lopencv_cudacodec/usr/bin/ld: cannot find -lopencv_cudaoptflow/usr/bin/ld: cannot find -lopencv_cudalegacy/usr/bin/ld: cannot find -lopencv_cudawarping/usr/bin/ld: cannot find -lopencv_cudaimgproc/usr/bin/ld: cannot find -lopencv_cudafilters/usr/bin/ld: cannot find -lopencv_cudaarithm/usr/bin/ld: cannot find -lopencv_cudev
2단계 해결: 라이브러리 경로 지정-L 경로 지정-L/usr/local/opencv3.4.0/lib g++ mtcnn_opencv.cpp -I/usr/local/opencv3.4.0/include -L/usr/local/opencv3.4.0/lib -shared -o libmtcnndetection2.so -std=c++ 11 -fPIC pkg-config opencv --cflags --libs
동적 링크 라이브러리 so 파일을 성공적으로 생성했습니다

좋은 웹페이지 즐겨찾기