Skip to content

in make step I meet a error with main.cpp #48

@jackft2

Description

@jackft2

my CmakeList :
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(yolo-app)

find_package( OpenCV 3.4.9 REQUIRED )
include_directories( ${OpenCV_INCLUDE_DIRS} )
message(${OpenCV_INCLUDE_DIRS})

find_package(Torch REQUIRED)

aux_source_directory(. DIR_SRCS)

add_executable(yolo-app ${DIR_SRCS})
target_link_libraries(yolo-app "${TORCH_LIBRARIES}" "${OpenCV_LIBS}")
set_property(TARGET yolo-app PROPERTY CXX_STANDARD 11)

my terminal show that:

ubuntu@ubuntu-System-Product-Name:/Desktop/coco/libtorch-yolov3-master/build$ cmake -DCMAKE_PREFIX_PATH='/home/ubuntu/Desktop/libtorch'
-- Caffe2: CUDA detected: 10.2
-- Caffe2: CUDA nvcc is: /usr/local/cuda-10.2/bin/nvcc
-- Caffe2: CUDA toolkit directory: /usr/local/cuda-10.2
-- Caffe2: Header version is: 10.2
-- Found cuDNN: v7.6.4 (include: /usr/local/cuda-10.2/include, library: /usr/local/cuda-10.2/lib64/libcudnn.so)
-- Autodetected CUDA architecture(s): 7.5
-- Added CUDA NVCC flags for: -gencode;arch=compute_75,code=sm_75
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ubuntu/Desktop/coco/libtorch-yolov3-master/build
ubuntu@ubuntu-System-Product-Name:
/Desktop/coco/libtorch-yolov3-master/build$ make -j4
Scanning dependencies of target yolo-app
[ 66%] Building CXX object CMakeFiles/yolo-app.dir/detect_cuda_compute_capabilities.cpp.o
[ 66%] Building CXX object CMakeFiles/yolo-app.dir/detect_cuda_version.cc.o
[100%] Linking CXX executable yolo-app
CMakeFiles/yolo-app.dir/detect_cuda_version.cc.o: In function main': detect_cuda_version.cc:(.text+0x0): multiple definition of main'
CMakeFiles/yolo-app.dir/detect_cuda_compute_capabilities.cpp.o:detect_cuda_compute_capabilities.cpp:(.text+0x0): first defined here
collect2: error: ld returned 1 exit status
CMakeFiles/yolo-app.dir/build.make:183: recipe for target 'yolo-app' failed
make[2]: *** [yolo-app] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/yolo-app.dir/all' failed
make[1]: *** [CMakeFiles/yolo-app.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions