Ubuntu下使用hdf5库时候遇到编译问题: error adding symbol: DSO missing from command line

背景:

已经在Ubuntu里安装后libhdf5-serial-dev的情况下,或者说在/usr/lib/x86_64-linux-gun里能找到libhdf5_serial.so.10的情况下,我在我的cpp里include了"H5Cpp.h",然后也调用了H5 namespace 下的很多函数。但在编译的时候遇到了如下问题:/usr/lib/x86_64-linux-gnu/libhdf5_serial.so.10:-1: error: error adding symbols: DSO missing from command line


1. 原因:

没有把hdf5_serial.so这个动态库连接到工程里。


2. 解决办法:

ADD_EXECUTABLE(${PROJECT_NAME} main.cpp)

TARGET_LINK_LIBRARIES(${PROJECT_NAME} hdf5_cpp hdf5_serial)


你可能感兴趣的:(Ubuntu,CMAKE,C++,HDF5)