0
cmakelist.txtメイクのOpenMP G ++ - 6.2.0がないようなファイル
cmake_minimum_required(VERSION 3.7)
project(multithreading)
# Find ITK.
find_package(ITK REQUIRED)
include(${ITK_USE_FILE})
FIND_PACKAGE(OpenMP REQUIRED)
if(OPENMP_FOUND)
message("OPENMP FOUND")
set(CMAKE_C_FLAGS “${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}”)
set(CMAKE_CXX_FLAGS “${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}“)
set(CMAKE_EXE_LINKER_FLAGS “${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}”)
endif()
add_executable(multithreading multithreading.cpp)
target_link_libraries(multithreading ${ITK_LIBRARIES})
TARGET_LINK_LIBRARIES(multithreading ${OpenMP_CXX_LIBRARIES})
そして私はAppleClangは-6.2.0をGCC、その後、 をCMakeのためにあるデフォルトコンパイラを変更する、すべてのOpenMPフラグが見つけ、 configureは正常です。/bin/gcc-6.2.0 -DCMAKE_CXX_COMPILER =/usr/local/gcc-6.2.0/bin/g ++ - 6.2.0 ./
私はG ++ -fopenmp myproject.cppそれはg++ -fopenmp multithreading.cpp
multithreading.cpp:4:44: fatal error: itkRescaleIntensityImageFilter.h: No such file or directory
#include "itkRescaleIntensityImageFilter.h"
^
compilation terminated.
だから、私はITKライブラリをリンクしませんならば、それは私に
canning dependencies of target multithreading
[ 50%] Building CXX object CMakeFiles/multithreading.dir/multithreading.cpp.o
g++-6.2.0: error: “: No such file or directory
g++-6.2.0: fatal error: no input files
compilation terminated.
/bin/sh: -fopenmp“: command not found
make[2]: *** [CMakeFiles/multithreading.dir/multithreading.cpp.o] Error 127
make[1]: *** [CMakeFiles/multithreading.dir/all] Error 2
make: *** [all] Error 2
を示して '作る' ん次回、その後
-- The C compiler identification is GNU 6.2.0
-- The CXX compiler identification is GNU 6.2.0
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - yes
-- Check for working C compiler: /usr/local/gcc-6.2.0/bin/gcc-6.2.0
-- Check for working C compiler: /usr/local/gcc-6.2.0/bin/gcc-6.2.0 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Check for working CXX compiler: /usr/local/gcc-6.2.0/bin/g++-6.2.0
-- Check for working CXX compiler: /usr/local/gcc-6.2.0/bin/g++-6.2.0 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Try OpenMP C flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Try OpenMP CXX flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Found OpenMP: -fopenmp
OPENMP FOUND
-- Configuring done
-- Generating done
どうすればその問題を解決できるのだろうかと思うので、同時にitkとopenmpをライブラリとして使用してください。
CMakeスクリプトで**言語固有の二重引用符**( '" ')を使用しないでください。 [類似の問題](http://stackoverflow.com/questions/41149743/cmake-set-property-could-not-find-cache-variable/41151401)が最近発生しました。 – Tsyvarev
ありがとう、私は慎重ではない – MYtry