情况:我想创建一个程序来从 .hdf5
文件中读取内容。
我做了什么:没什么,只是将 hdf5.lib
添加到项目中。
问题:
我有两个错误
当我尝试运行程序时。
cannot find -lhdf5d
error: ld returned 1 exit status
我的代码:
HDF5_Test.pro
:
TEMPLATE = app
CONFIG += console c++11
CONFIG -= app_bundle
CONFIG -= qt
SOURCES += \
main.cpp
win32:CONFIG(release, debug|release): LIBS += -L'C:/Program Files/HDF_Group/HDF5/1.10.2/lib/' -lhdf5
else:win32:CONFIG(debug, debug|release): LIBS += -L'C:/Program Files/HDF_Group/HDF5/1.10.2/lib/' -lhdf5d
else:unix: LIBS += -L'C:/Program Files/HDF_Group/HDF5/1.10.2/lib/' -lhdf5
INCLUDEPATH += 'C:/Program Files/HDF_Group/HDF5/1.10.2/include'
DEPENDPATH += 'C:/Program Files/HDF_Group/HDF5/1.10.2/include'
main.cpp
:
#define H5_SIZEOF_SSIZE_T H5_SIZEOF_LONG_LONG //this is needed to avoid redefinition conflict of ssize_t (Qt vs HDF5)
#include <hdf5.h>
#include <H5Cpp.h> //Tried with and without this include
int main()
{
return 0;
}
使用:
- C++
- Qt 5.10.1
- MinGW 32 位
- HDF5 1.10.2
- Windows 7
在另一个项目中,无论出于何种原因,这些错误都不会发生,但是这些。
.
最佳答案
我是 linux,使用 apt-get install libhdf5-dev 我们安装了 8 个库,但没有一个是 lihdf5 的“本质”。我的意思是我的包含将是 -lhdf5_openmpi
而不是 -lhdf5
。由于您没有提供下载源,请尝试检查您的/lib
文件中是否有多个库
关于C++ HDF5 找不到-lhdf5d,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50930693/