ShiqiYu / libfacedetection

An open source library for face detection in images. The face detection speed can reach 1000FPS.
Other
12.27k stars 3.05k forks source link

build detect-image.exe get `undefined reference to __imp__Z14facedetect_cnnPhS_iii` #361

Closed igo312 closed 1 year ago

igo312 commented 1 year ago

I build the facedetection by the instruction of build by MinGw, and the cmake that to build detect-image.exe is following:

I build the project by two instructions:

cmake -G "MinGW Makefiles"
cmake --build . 

can anyone tell me what should I do?

cmake_minimum_required(VERSION 3.05)
project(detect-image)

set(TARGET "det_image")

set(CMAKE_C_COMPILIER "gcc")
set(CMAKE_C_COMPILIER "g++")

find_package(OpenCV REQUIRED)
find_package(facedetection REQUIRED)
if(facedetection_FOUND)
   message("find facedetection")
   endif()

include_directories("D:\\code\\c++\\libfacedetection\\build\\install\\include\\facedetection")

add_executable(${TARGET} detect-image.cpp)
target_link_libraries(${TARGET} ${OpenCV_LIBS})
target_link_libraries(${TARGET} ${facedetection_LIBS})
Wwupup commented 1 year ago

I build the facedetection by the instruction of build by MinGw, and the cmake that to build detect-image.exe is following:

I build the project by two instructions:

cmake -G "MinGW Makefiles"
cmake --build . 

can anyone tell me what should I do?

cmake_minimum_required(VERSION 3.05)
project(detect-image)

set(TARGET "det_image")

set(CMAKE_C_COMPILIER "gcc")
set(CMAKE_C_COMPILIER "g++")

find_package(OpenCV REQUIRED)
find_package(facedetection REQUIRED)
if(facedetection_FOUND)
   message("find facedetection")
   endif()

include_directories("D:\\code\\c++\\libfacedetection\\build\\install\\include\\facedetection")

add_executable(${TARGET} detect-image.cpp)
target_link_libraries(${TARGET} ${OpenCV_LIBS})
target_link_libraries(${TARGET} ${facedetection_LIBS})

Hello, it might be due to the lack of header files. Please confirm if you have correctly imported facedetection.h and facedetection_export.h.

igo312 commented 1 year ago

@Wwupup thanks for your response! I know the mistake in my cmake file.

target_link_libraries(${TARGET} ${facedetection_LIBS})

should be

target_link_libraries(${TARGET} facedetection)

it is weird that ${facedetection_LIBS} is empty