FeiYull / TensorRT-Alpha

🔥🔥🔥TensorRT for YOLOv8、YOLOv8-Pose、YOLOv8-Seg、YOLOv8-Cls、YOLOv7、YOLOv6、YOLOv5、YOLONAS......🚀🚀🚀CUDA IS ALL YOU NEED.🍎🍎🍎
GNU General Public License v2.0
1.3k stars 201 forks source link

Windows Cmake编译错误 #114

Closed gbdjxgp closed 5 months ago

gbdjxgp commented 5 months ago

使用环境: cuda11.8 TensorRT-8.6.1.6 cudnn-windows-x86_64-8.9.7.29_cuda11 visual studio 2022 VCPKG安装的opencv:x64-windows 4.8.0#1 1.直接编译报错 CMake Error: The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files: TRT_NVCAFFE_PARSER 2.common.cmake修改: `#find_library(TRT_NVCAFFE_PARSER NAMES nvcaffe_parser HINTS ${TensorRT_ROOT} PATH_SUFFIXES lib lib64 lib/x64)

list(APPEND ALL_LIBS ${TRT_NVINFER} ${TRT_NVINFER_PLUGIN} ${TRT_NVONNX_PARSER} ${TRT_NVCAFFE_PARSER})

list(APPEND ALL_LIBS ${TRT_NVINFER} ${TRT_NVINFER_PLUGIN} ${TRT_NVONNX_PARSER}) `

重新cmake -Bbuild得到日志

`PS C:\code\zdx\TensorRT-Alpha\yolov8> cmake -Bbuild -DCMAKE_TOOLCHAIN_FILE="C:\ProgramData\vcpkg\scripts\buildsystems\vcpkg.cmake" -- Building for: Visual Studio 17 2022 -- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.22631. -- The C compiler identification is MSVC 19.38.33134.0 -- The CXX compiler identification is MSVC 19.38.33134.0 -- The CUDA compiler identification is NVIDIA 11.8.89 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Detecting CUDA compiler ABI info -- Detecting CUDA compiler ABI info - done -- Check for working CUDA compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8/bin/nvcc.exe - skipped -- Detecting CUDA compile features -- Detecting CUDA compile features - done -- CMAKE_CURRENT_SOURCE_DIR=C:/code/zdx/TensorRT-Alpha/yolov8 CMake Warning (dev) at C:/ProgramData/vcpkg/scripts/buildsystems/vcpkg.cmake:859 (_find_package): Policy CMP0146 is not set: The FindCUDA module is removed. Run "cmake --help-policy CMP0146" for policy details. Use the cmake_policy command to set the policy and suppress this warning.

Call Stack (most recent call first): C:/code/zdx/TensorRT-Alpha/cmake/common.cmake:4 (find_package) CMakeLists.txt:8 (include) This warning is for project developers. Use -Wno-dev to suppress it.

-- Found CUDA: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8 (found version "11.8") -- INCLUDE_DRIS=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8/includeC:/ProgramData/TensorRT-8.6.1.6/includeC:/ProgramData/TensorRT-8.6.1.6/samples/common -- ALL_LIBS: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8/lib/x64/cudart_static.lib;C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8/lib/x64/cublas.lib;C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8/lib/x64/nppc.lib;C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8/lib/x64/nppig.lib;C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8/lib/x64/nppidei.lib;C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8/lib/x64/nppial.lib;C:/ProgramData/TensorRT-8.6.1.6/lib/nvinfer.lib;C:/ProgramData/TensorRT-8.6.1.6/lib/nvinfer_plugin.lib;C:/ProgramData/TensorRT-8.6.1.6/lib/nvonnxparser.lib;TRT_NVCAFFE_PARSER-NOTFOUND -- TensorRT_ROOT=C:/ProgramData/TensorRT-8.6.1.6 -- C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8/lib/x64/cudart_static.libC:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8/lib/x64/cublas.libC:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8/lib/x64/nppc.libC:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8/lib/x64/nppig.libC:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8/lib/x64/nppidei.libC:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8/lib/x64/nppial.libC:/ProgramData/TensorRT-8.6.1.6/lib/nvinfer.libC:/ProgramData/TensorRT-8.6.1.6/lib/nvinfer_plugin.libC:/ProgramData/TensorRT-8.6.1.6/lib/nvonnxparser.libTRT_NVCAFFE_PARSER-NOTFOUND -- CPPS=C:/ProgramData/TensorRT-8.6.1.6/samples/common/logger.cppC:/ProgramData/TensorRT-8.6.1.6/samples/common/sampleOptions.cppC:/code/zdx/TensorRT-Alpha/yolov8/../utils/kernel_function.cuC:/code/zdx/TensorRT-Alpha/yolov8/../utils/utils.cppC:/code/zdx/TensorRT-Alpha/yolov8/../utils/yolo.cppC:/code/zdx/TensorRT-Alpha/yolov8/app_yolov8.cppC:/code/zdx/TensorRT-Alpha/yolov8/decode_yolov8.cuC:/code/zdx/TensorRT-Alpha/yolov8/yolov8.cpp -- length=8 -- Found Protobuf: C:/ProgramData/vcpkg/installed/x64-windows/tools/protobuf/protoc.exe (found version "3.21.12.0") -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - not found -- Found Threads: TRUE -- Found TIFF: C:/ProgramData/anaconda3/Library/lib/cmake/tiff (found version "4.5.1") -- Found OpenCV: C:/ProgramData/vcpkg/installed/x64-windows (found version "4.8.0") -- INCLUDE_DRIS=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8/includeC:/ProgramData/TensorRT-8.6.1.6/includeC:/ProgramData/TensorRT-8.6.1.6/samples/common -- OpenCV_INCLUDE_DIRS=C:/ProgramData/vcpkg/installed/x64-windows/include -- Configuring done (7.6s) CMake Error: The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files: TRT_NVCAFFE_PARSER linked by target "yolov8" in directory C:/code/zdx/TensorRT-Alpha/yolov8 linked by target "app_yolov8" in directory C:/code/zdx/TensorRT-Alpha/yolov8

-- Generating done (0.0s) CMake Generate step failed. Build files cannot be regenerated correctly. (base) PS C:\code\zdx\TensorRT-Alpha\yolov8> cmake -Bbuild -DCMAKE_TOOLCHAIN_FILE="C:\ProgramData\vcpkg\scripts\buildsystems\vcpkg.cmake" -- Building for: Visual Studio 17 2022 -- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.22631. -- The C compiler identification is MSVC 19.38.33134.0 -- The CXX compiler identification is MSVC 19.38.33134.0 -- The CUDA compiler identification is NVIDIA 11.8.89 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Detecting CUDA compiler ABI info -- Detecting CUDA compiler ABI info - done -- Check for working CUDA compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8/bin/nvcc.exe - skipped -- Detecting CUDA compile features -- Detecting CUDA compile features - done -- CMAKE_CURRENT_SOURCE_DIR=C:/code/zdx/TensorRT-Alpha/yolov8 CMake Warning (dev) at C:/ProgramData/vcpkg/scripts/buildsystems/vcpkg.cmake:859 (_find_package): Policy CMP0146 is not set: The FindCUDA module is removed. Run "cmake --help-policy CMP0146" for policy details. Use the cmake_policy command to set the policy and suppress this warning.

Call Stack (most recent call first): C:/code/zdx/TensorRT-Alpha/cmake/common.cmake:4 (find_package) CMakeLists.txt:8 (include) This warning is for project developers. Use -Wno-dev to suppress it.

-- Found CUDA: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8 (found version "11.8") -- INCLUDE_DRIS=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8/includeC:/ProgramData/TensorRT-8.6.1.6/includeC:/ProgramData/TensorRT-8.6.1.6/samples/common -- ALL_LIBS: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8/lib/x64/cudart_static.lib;C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8/lib/x64/cublas.lib;C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8/lib/x64/nppc.lib;C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8/lib/x64/nppig.lib;C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8/lib/x64/nppidei.lib;C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8/lib/x64/nppial.lib;C:/ProgramData/TensorRT-8.6.1.6/lib/nvinfer.lib;C:/ProgramData/TensorRT-8.6.1.6/lib/nvinfer_plugin.lib;C:/ProgramData/TensorRT-8.6.1.6/lib/nvonnxparser.lib -- TensorRT_ROOT=C:/ProgramData/TensorRT-8.6.1.6 -- C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8/lib/x64/cudart_static.libC:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8/lib/x64/cublas.libC:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8/lib/x64/nppc.libC:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8/lib/x64/nppig.libC:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8/lib/x64/nppidei.libC:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8/lib/x64/nppial.libC:/ProgramData/TensorRT-8.6.1.6/lib/nvinfer.libC:/ProgramData/TensorRT-8.6.1.6/lib/nvinfer_plugin.libC:/ProgramData/TensorRT-8.6.1.6/lib/nvonnxparser.lib -- CPPS=C:/ProgramData/TensorRT-8.6.1.6/samples/common/logger.cppC:/ProgramData/TensorRT-8.6.1.6/samples/common/sampleOptions.cppC:/code/zdx/TensorRT-Alpha/yolov8/../utils/kernel_function.cuC:/code/zdx/TensorRT-Alpha/yolov8/../utils/utils.cppC:/code/zdx/TensorRT-Alpha/yolov8/../utils/yolo.cppC:/code/zdx/TensorRT-Alpha/yolov8/app_yolov8.cppC:/code/zdx/TensorRT-Alpha/yolov8/decode_yolov8.cuC:/code/zdx/TensorRT-Alpha/yolov8/yolov8.cpp -- length=8 -- Found Protobuf: C:/ProgramData/vcpkg/installed/x64-windows/tools/protobuf/protoc.exe (found version "3.21.12.0") -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - not found -- Found Threads: TRUE -- Found TIFF: C:/ProgramData/anaconda3/Library/lib/cmake/tiff (found version "4.5.1") -- Found OpenCV: C:/ProgramData/vcpkg/installed/x64-windows (found version "4.8.0") -- INCLUDE_DRIS=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8/includeC:/ProgramData/TensorRT-8.6.1.6/includeC:/ProgramData/TensorRT-8.6.1.6/samples/common -- OpenCV_INCLUDE_DIRS=C:/ProgramData/vcpkg/installed/x64-windows/include -- Configuring done (7.6s) -- Generating done (0.0s) -- Build files have been written to: C:/code/zdx/TensorRT-Alpha/yolov8/build 3.再次编译cmake --build build报错 LINK : warning LNK4098: 默认库“LIBCMT”与其他库的使用冲突;请使用 /NODEFAULTLIB:library [C:\code\zdx\TensorRT-Alpha\yolov8\build\yolov8. vcxproj] sampleOptions.obj : error LNK2019: 无法解析的外部符号 "class std::vector<class std::basic_string<char,struct std::char_traits<ch ar>,class std::allocator >,class std::allocator<class std::basic_string<char,struct std::char_traits,class std::allocator > > > cdecl sample::splitToStringVec(class std::basic_string<char,struct std::char_traits, class std::allocator > const &,char)" (?splitToStringVec@sample@@YA?AV?$vector@V?$basic_string@DU?$char_traits@D@ std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@AEBV?$b asic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@D@Z),函数 "public: virtual void cdecl sample::UffInput::parse(cl ass std::unordered_multimap<class std::basic_string<char,struct std::char_traits,class std::allocator >,cla ss std::basic_string<char,struct std::chartraits,class std::allocator >,struct std::hash<class std::basic string<char,struct std::char_traits,class std::allocator > >,struct std::equal_to<class std::basic_string<c har,struct std::char_traits,class std::allocator > >,class std::allocator<struct std::pair<class std::basic _string<char,struct std::char_traits,class std::allocator > const ,class std::basic_string<char,struct std: :char_traits,class std::allocator > > > > &)" (?parse@UffInput@sample@@UEAAXAEAV?$unordered_multimap@V?$bas ic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@U?$hash@V?$basic_string@DU?$char_traits@D@std@@V?$allocator @D@2@@std@@@2@U?$equal_to@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@V?$allocator@U?$pair@$$CBV?$ basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@@std@@@2@@std@@@Z) 中引用了该符号 [C:\code\zdx\TensorRT-Alpha\y olov8\build\yolov8.vcxproj] C:\code\zdx\TensorRT-Alpha\yolov8\build\Debug\yolov8.dll : fatal error LNK1120: 1 个无法解析的外部命令 [C:\code\zdx\TensorRT-Alph a\yolov8\build\yolov8.vcxproj]`

gbdjxgp commented 5 months ago

同样按照这个博客中配置环境,系统为windows 11,visual studio2022进行设置https://blog.csdn.net/m0_72734364/article/details/128865904?csdn_share_tail=%7B%22type%22%3A%22blog%22%2C%22rType%22%3A%22article%22%2C%22rId%22%3A%22128865904%22%2C%22source%22%3A%22m0_72734364%22%7D&fromshare=blogdetail 编译后报错 严重性 代码 说明 项目 文件 行 禁止显示状态 详细信息 错误 LNK2019 无法解析的外部符号 "class nvinfer1::IBuilder cdecl createBuilder(void)" (?createBuilder@@YAPEAVIBuilder@nvinfer1@@XZ),函数 "bool cdecl sample::modelToBuildEnv(class sample::ModelOptions const &,class sample::BuildOptions const &,class sample::SystemOptions &,struct sample::BuildEnvironment &,class std::basic_ostream<char,struct std::char_traits > &)" (?modelToBuildEnv@sample@@YA_NAEBVModelOptions@1@AEBVBuildOptions@1@AEAVSystemOptions@1@AEAUBuildEnvironment@1@AEAV?$basic_ostream@DU?$char_traits@D@std@@@std@@@Z) 中引用了该符号 yolo C:\code\c++\yolo\yolo\sampleEngines.obj 1
错误 LNK2019 无法解析的外部符号 "class nvinfer1::IRuntime
cdecl createRuntime(void)" (?createRuntime@@YAPEAVIRuntime@nvinfer1@@XZ),函数 "public: class nvinfer1::ICudaEngine * cdecl sample::LazilyDeserializedEngine::get(void)" (?get@LazilyDeserializedEngine@sample@@QEAAPEAVICudaEngine@nvinfer1@@XZ) 中引用了该符号 yolo C:\code\c++\yolo\yolo\sampleEngines.obj 1
错误 LNK2001 无法解析的外部符号 "class nvinfer1::IRuntime __cdecl createRuntime(void)" (?createRuntime@@YAPEAVIRuntime@nvinfer1@@XZ) yolo C:\code\c++\yolo\yolo\sampleInference.obj 1
错误 LNK2019 无法解析的外部符号 "class nvinfer1::IRefitter
cdecl createRefitter(class nvinfer1::ICudaEngine &)" (?createRefitter@@YAPEAVIRefitter@nvinfer1@@AEAVICudaEngine@2@@Z),函数 "void cdecl sample::dumpRefittable(class nvinfer1::ICudaEngine &)" (?dumpRefittable@sample@@YAXAEAVICudaEngine@nvinfer1@@@Z) 中引用了该符号 yolo C:\code\c++\yolo\yolo\sampleEngines.obj 1
错误 LNK2019 无法解析的外部符号 "class nvonnxparser::IParser cdecl createONNXParser(class nvinfer1::INetworkDefinition &)" (?createONNXParser@@YAPEAVIParser@nvonnxparser@@AEAVINetworkDefinition@nvinfer1@@@Z),函数 "struct sample::Parser cdecl sample::modelToNetwork(class sample::ModelOptions const &,class sample::BuildOptions const &,class nvinfer1::INetworkDefinition &,class std::basic_ostream<char,struct std::char_traits > &,class std::vector<class std::basic_string<char,struct std::char_traits,class std::allocator >,class std::allocator<class std::basic_string<char,struct std::char_traits,class std::allocator > > > )" (?modelToNetwork@sample@@YA?AUParser@1@AEBVModelOptions@1@AEBVBuildOptions@1@AEAVINetworkDefinition@nvinfer1@@AEAV?$basic_ostream@DU?$char_traits@D@std@@@std@@PEAV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@8@@Z) 中引用了该符号 yolo C:\code\c++\yolo\yolo\sampleEngines.obj 1
错误 LNK2019 无法解析的外部符号 "class nvcaffeparser1::ICaffeParser cdecl sampleCreateCaffeParser(void)" (?sampleCreateCaffeParser@@YAPEAVICaffeParser@nvcaffeparser1@@XZ),函数 "struct sample::Parser cdecl sample::modelToNetwork(class sample::ModelOptions const &,class sample::BuildOptions const &,class nvinfer1::INetworkDefinition &,class std::basic_ostream<char,struct std::char_traits > &,class std::vector<class std::basic_string<char,struct std::char_traits,class std::allocator >,class std::allocator<class std::basic_string<char,struct std::char_traits,class std::allocator > > > )" (?modelToNetwork@sample@@YA?AUParser@1@AEBVModelOptions@1@AEBVBuildOptions@1@AEAVINetworkDefinition@nvinfer1@@AEAV?$basic_ostream@DU?$char_traits@D@std@@@std@@PEAV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@8@@Z) 中引用了该符号 yolo C:\code\c++\yolo\yolo\sampleEngines.obj 1
错误 LNK2019 无法解析的外部符号 "void cdecl shutdownCaffeParser(void)" (?shutdownCaffeParser@@YAXXZ),函数 "public: cdecl sample::anonymous namespace'::CaffeBufferShutter::~CaffeBufferShutter(void)" (??1CaffeBufferShutter@?A0x3b17950c@sample@@QEAA@XZ) 中引用了该符号 yolo C:\code\c++\yolo\yolo\sampleEngines.obj 1 错误 LNK2019 无法解析的外部符号 "class nvuffparser::IUffParser * __cdecl sampleCreateUffParser(void)" (?sampleCreateUffParser@@YAPEAVIUffParser@nvuffparser@@XZ),函数 "struct sample::Parser __cdecl sample::modelToNetwork(class sample::ModelOptions const &,class sample::BuildOptions const &,class nvinfer1::INetworkDefinition &,class std::basic_ostream<char,struct std::char_traits<char> > &,class std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > > *)" (?modelToNetwork@sample@@YA?AUParser@1@AEBVModelOptions@1@AEBVBuildOptions@1@AEAVINetworkDefinition@nvinfer1@@AEAV?$basic_ostream@DU?$char_traits@D@std@@@std@@PEAV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@8@@Z) 中引用了该符号 yolo C:\code\c++\yolo\yolo\sampleEngines.obj 1 错误 LNK2019 无法解析的外部符号 "void __cdecl shutdownUffParser(void)" (?shutdownUffParser@@YAXXZ),函数 "public: __cdecl sample::anonymous namespace'::UffBufferShutter::~UffBufferShutter(void)" (??1UffBufferShutter@?A0x3b17950c@sample@@QEAA@XZ) 中引用了该符号 yolo C:\code\c++\yolo\yolo\sampleEngines.obj 1
错误 LNK1120 8 个无法解析的外部命令 yolo C:\code\c++\yolo\yolo\x64\Debug\yolo.exe 1

image

ymhlq commented 5 months ago

你这个问题解决了吗,老哥,我没使用Cmake编译,但是配置过程中同样报错 严重性 代码 说明 项目 文件 行 禁止显示状态 错误 LNK2001 无法解析的外部符号 "class std::vector<class std::basic_string<char,struct std::char_traits,class std::allocator >,class std::allocator<class std::basic_string<char,struct std::char_traits,class std::allocator > > > __cdecl sample::splitToStringVec(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,char)" (?splitToStringVec@sample@@YA?AV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@D@Z) code E:\yolov8_tensor\yolov8\code\sampleOptions.obj 1
严重性 代码 说明 项目 文件 行 禁止显示状态 错误 LNK1120 1 个无法解析的外部命令 code E:\yolov8_tensor\yolov8\x64\Release\code.exe 1

gbdjxgp commented 5 months ago

你这个问题解决了吗,老哥,我没使用Cmake编译,但是配置过程中同样报错 严重性 代码 说明 项目 文件 行 禁止显示状态 错误 LNK2001 无法解析的外部符号 "class std::vector<class std::basic_string<char,struct std::char_traits,class std::allocator >,class std::allocator<class std::basic_string<char,struct std::char_traits,class std::allocator > > > __cdecl sample::splitToStringVec(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,char)" (?splitToStringVec@sample@@ya?AV?$vector@V?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@v?$allocator@V?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@@2@@std@@aebv?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@3@D@Z) code E:\yolov8_tensor\yolov8\code\sampleOptions.obj 1 严重性 代码 说明 项目 文件 行 禁止显示状态 错误 LNK1120 1 个无法解析的外部命令 code E:\yolov8_tensor\yolov8\x64\Release\code.exe 1

一直没有解决呢,我也按照CSDN(https://blog.csdn.net/m0_72734364/article/details/128865904?csdn_share_tail=%7B%22type%22%3A%22blog%22%2C%22rType%22%3A%22article%22%2C%22rId%22%3A%22128865904%22%2C%22source%22%3A%22m0_72734364%22%7D&fromshare=blogdetail)上的教程尝试过不用CMAKE编译,同样也是报错

gbdjxgp commented 5 months ago

你这个问题解决了吗,老哥,我没使用Cmake编译,但是配置过程中同样报错 严重性 代码 说明 项目 文件 行 禁止显示状态 错误 LNK2001 无法解析的外部符号 "class std::vector<class std::basic_string<char,struct std::char_traits,class std::allocator >,class std::allocator<class std::basic_string<char,struct std::char_traits,class std::allocator > > > __cdecl sample::splitToStringVec(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,char)" (?splitToStringVec@sample@@ya?AV?$vector@V?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@v?$allocator@V?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@std@@@2@@std@@aebv?$basic_string@DU?$char_traits@D@std@@v?$allocator@D@2@@3@D@Z) code E:\yolov8_tensor\yolov8\code\sampleOptions.obj 1 严重性 代码 说明 项目 文件 行 禁止显示状态 错误 LNK1120 1 个无法解析的外部命令 code E:\yolov8_tensor\yolov8\x64\Release\code.exe 1

我使用CMake编译成功了,你不要把sampleOptions加入到链接过程里应该就可以了

ymhlq commented 5 months ago

我试试

ymhlq commented 5 months ago

牛逼,我没用cmake,直接把sample options删掉就编译成功了