Giter Site home page Giter Site logo

Comments (5)

gaoxiang12 avatar gaoxiang12 commented on July 2, 2024

你的cmakelist怎么写了?链到Eigen上去了吗?

from slambook2.

bene-yan avatar bene-yan commented on July 2, 2024

感谢高博的回复!
Eigen是只需要include_dir就行吧?我的CMakeLists.txt是这样写的:

cmake_minimum_required(VERSION 2.8)

project(imageBasics)

set(CMAKE_CXX_FLAGS "-std=c++11")

find_package(OpenCV REQUIRED)

include_directories(${OpenCV_INCLUDE_DIRS})
include_directories("/usr/include/eigen3")

add_executable(imageBasics imageBasics.cpp)

target_link_libraries(imageBasics ${OpenCV_LIBS})

我运行从您的仓库中git clone过来的代码也是报同样的错误。
另外,安装依赖项的时候,libvtk5-dev提示无法安装,我装的是libvtk6-dev。所以一开始有很多类似报错都是/usr/bin/ld: 找不到 -ltk***。不知道是不是这个原因?我安装的OpenCV 版本是3.4.7

from slambook2.

gaoxiang12 avatar gaoxiang12 commented on July 2, 2024

你上面贴的错误和opencv应该没关系。这个cmakelist也会报eigen的链接错误吗?

from slambook2.

bene-yan avatar bene-yan commented on July 2, 2024

是的,用这个cmakelists也会报eigen的错误。然后我重新做了下ch3的useEigen,没有问题。

ch5的这个程序cmake时有一个warning,而且这个warning重复出了十多次,下面我只贴出了一段这样的waring。会不会是我的cmake的问题?

-- The C compiler identification is GNU 7.4.0
-- The CXX compiler identification is GNU 7.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenCV: /usr/local (found version "3.4.7") 
-- Configuring done
CMake Warning (dev) at CMakeLists.txt:13 (add_executable):
  Policy CMP0028 is not set: Double colon in target name means ALIAS or
  IMPORTED target.  Run "cmake --help-policy CMP0028" for policy details.
  Use the cmake_policy command to set the policy and suppress this warning.

  Target "imageBasics" links to target "Eigen3::Eigen" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
This warning is for project developers.  Use -Wno-dev to suppress it.
【重复】

-- Generating done
-- Build files have been written to: /home/bene-robot/slambook2/ch5/imageBasics/build

from slambook2.

bene-yan avatar bene-yan commented on July 2, 2024

问题解决了!我改了cmakelist的写法,新的cmakelist如下:

cmake_minimum_required(VERSION 2.8)

project(imageBasics)

set(CMAKE_CXX_FLAGS "-std=c++11")

find_package(OpenCV REQUIRED)

include_directories(${OpenCV_INCLUDE_DIRS})

find_package(Eigen3 REQUIRED)
include_directories( EIGEN3_INCLUDE_DIRS)
#include_directories("/usr/include/eigen3")
message(${EIGEN3_INCLUDE_DIRS})

add_executable(imageBasics imageBasics.cpp)

target_link_libraries(imageBasics ${OpenCV_LIBS})

就是把#include_directories("/usr/include/eigen3")改成了

find_package(Eigen3 REQUIRED)
include_directories( EIGEN3_INCLUDE_DIRS)

是参考了这个链接https://stackoverflow.com/questions/12249140/find-package-eigen3-for-cmake

但是message输出的信息也是/usr/include/eigen3,不知道为什么直接用#include_directories("/usr/include/eigen3")就不行。

from slambook2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.