我正在Ubuntu上使用cMake-gui/make编译软件包。程序包需要pyublas的地址,默认情况下位于/usr/local/lib/python2.7/dist-packages/pyublas。配置并运行make之后,使用正确的参数g++调用-I /usr/local/lib/python2.7/dist-packages/pyublas,但是g++-4.6产生错误消息:



检查pyublas我可以在该文件夹中看到numpy.hpp
将pyublas文件夹更改为/usr/local/lib/python2.7/dist-packages(由一个文件夹向上移动)无法解决问题。它产生完全相同的错误。

我不知道出什么事了!

Here's the CMakeLists.txt:
cmake_minimum_required( VERSION 2.6 FATAL_ERROR )

#
# If the user specifies -DCMAKE_BUILD_TYPE on the command line, take their
# definition # and dump it in the cache along with proper documentation,
# otherwise set CMAKE_BUILD_TYPE # to Debug prior to calling PROJECT()
#
IF(DEFINED CMAKE_BUILD_TYPE)
   SET(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
ELSE()
    SET(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel.")
ENDIF()

PROJECT(CUV Fortran CXX C)
SET(CMAKE_MODULE_PATH  ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/CMakeModules )

EXECUTE_PROCESS(COMMAND "date" "+%Y%m%d%H%M" OUTPUT_VARIABLE DATESTR)
string(REGEX REPLACE "^(....)(..)(..)(..)(..).*" "\\1\\2\\3\\4\\5" DATESTR ${DATESTR})

SET(LIB_SUFFIX "")
IF("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
    SET(LIB_SUFFIX _dbg)
ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")


INCLUDE(InstallRequiredSystemLibraries)

SET(CPACK_SOURCE_GENERATOR "DEB")
SET(CPACK_GENERATOR "DEB")
#SET(CPACK_PACKAGE_NAME "cuv${LIB_SUFFIX}")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "N-dimensional array datastructures and algorithms on CPU and GPU")
SET(CPACK_PACKAGE_VENDOR "Hannes Schulz")
SET(CPACK_PACKAGE_CONTACT "Hannes Schulz <[email protected]>")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README")
IF( CMAKE_SIZEOF_VOID_P EQUAL 8 )
    SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
ENDIF( CMAKE_SIZEOF_VOID_P EQUAL 8 )
SET(CPACK_PACKAGE_VERSION_MAJOR "0")
SET(CPACK_PACKAGE_VERSION_MINOR "9")
SET(CPACK_PACKAGE_VERSION_PATCH ${DATESTR})
SET(CPACK_SOURCE_IGNORE_FILES "${CPACK_SOURCE_IGNORE_FILES};cfg/config.h;${CMAKE_SOURCE_DIR}/.git;${CMAKE_SOURCE_DIR}/src/matrix_ops/spmv_kernel_inst.cuh;${CMAKE_SOURCE_DIR}/src/matrix_ops/spmv_kernel_inst.cuh-;${CMAKE_SOURCE_DIR}/build;${CMAKE_SOURCE_DIR}/debug")
SET(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}${LIB_SUFFIX}_${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
SET (CPACK_OUTPUT_FILE_PREFIX "../..")
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Hannes Schulz <[email protected]>")
SET(CPACK_DEBIAN_PACKAGE_SECTION "devel")
SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/prerm;")
#SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/postinst;")
#SET(CPACK_PACKAGE_INSTALL_DIRECTORY "cuv${LIB_SUFFIX}")
SET(CPACK_DEBIAN_PACKAGE_DEPENDS    "libboost-dev, libblas-dev, libpng-dev, libjpeg-dev" )
SET(CPACK_DEBIAN_PACKAGE_SUGGESTS   "cimg-dev, python-dev, libboost-python-dev" )
INCLUDE(CPack)

FIND_PACKAGE(Doxygen)
IF(DOXYGEN_FOUND)
    CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/doc/Doxyfile.in ${CMAKE_BINARY_DIR}/docs/Doxyfile)
    ADD_CUSTOM_COMMAND(
        DEPENDS ${CMAKE_BINARY_DIR}/docs/Doxyfile
        OUTPUT  ${CMAKE_BINARY_DIR}/docs/html/index.html
        COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/docs/Doxyfile
        WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
        )
    ADD_CUSTOM_TARGET(doc DEPENDS ${CMAKE_BINARY_DIR}/docs/html/index.html ${CMAKE_BINARY_DIR}/docs/Doxyfile)
ENDIF(DOXYGEN_FOUND)

ENABLE_TESTING()
add_subdirectory(src)

最佳答案

添加您的CMakeLists.txt(最终在src目录的CMakeLists.txt中)

include_directories(/usr/local/lib/python2.7/dist-packages/)

并将其从cmake调用中删除。

如果它不起作用,也请在src目录中发布CMakeLists.txt。

08-05 11:58