与silo库的g ++静态链接问题

时间:2013-08-08 19:25:03

标签: g++ static-libraries silo

我有一些使用silo库的示例代码:

#include <silo.h>
#include <iostream>
int main(int argc, char *argv[])
{
    DBfile *dbfile = NULL;
        /* Open the Silo file */
    dbfile = DBCreate("basic.silo" , DB_CLOBBER, DB_LOCAL,"Comment about the data", DB_HDF5);

    if(dbfile == NULL)
    {
        return -1;
    }
    /* Add other Silo calls here. */
    /* Close the Silo file. */
    DBClose(dbfile);
    return 0;
}

我通过macports安装了silo库。筒仓端口包含:

Port silo contains:
  /opt/local/include/ioperf.h
  /opt/local/include/pmpio.h
  /opt/local/include/silo.h
  /opt/local/include/silo.inc
  /opt/local/lib/libsiloh5.a
  /opt/local/lib/libsiloh5.la
  /opt/local/lib/libsiloh5.settings 

当我尝试使用以下代码编译示例代码时

g++ functions.cpp /opt/local/lib/libsiloh5.a 

我收到了大量错误:

Undefined symbols for architecture x86_64:
  "_H5Aclose", referenced from:
      _db_hdf5_Open in libsiloh5.a(silo_hdf5.o)
      _db_hdf5_Create in libsiloh5.a(silo_hdf5.o)
      _db_hdf5_GetObject in libsiloh5.a(silo_hdf5.o)
      _db_hdf5_InqVarType in libsiloh5.a(silo_hdf5.o)
      _db_hdf5_InqMeshName in libsiloh5.a(silo_hdf5.o)
      _db_hdf5_GetCurve in libsiloh5.a(silo_hdf5.o)
      _db_hdf5_GetCsgmesh in libsiloh5.a(silo_hdf5.o)
      ...
  "_H5Acreate1", referenced from:
      _db_hdf5_Create in libsiloh5.a(silo_hdf5.o)
      _db_hdf5_hdrwr in libsiloh5.a(silo_hdf5.o)
      _db_hdf5_compname in libsiloh5.a(silo_hdf5.o)
  "_H5Aget_type", referenced from:
      _db_hdf5_GetObject in libsiloh5.a(silo_hdf5.o)
      _db_hdf5_GetComponentStuff in libsiloh5.a(silo_hdf5.o)
      _db_hdf5_get_comp_var in libsiloh5.a(silo_hdf5.o)
      _copy_dir in libsiloh5.a(silo_hdf5.o)

线条和线条继续......

我做错了什么?

由于

1 个答案:

答案 0 :(得分:1)

您需要链接HDF5库。 Silo位于其他低级存储库之上,如PDB,NetCDF和HDF5。