Qt错误:对`srcml_create_archive'的未定义引用

时间:2014-10-22 22:04:45

标签: c++ qt

您好我是用Qt从C ++开始的,我想添加第三部分库,但我有一些错误:

#include <srcml.h>

int main()
{
    srcml_archive* srcml_arch = srcml_create_archive();
    srcml_read_open_filename(srcml_arch,"suma.c.xml");

    srcml_unit* unit = srcml_read_unit(srcml_arch);

    srcml_unparse_unit_filename(unit,"suma.c");
    srcml_free_unit(unit);

    srcml_close_archive(srcml_arch);
    srcml_free_archive(srcml_arch);

    return 0;
}

这是错误:

/h...cML/main.cpp:11: error: undefined reference to `srcml_create_archive'

我想知道,为什么?

1 个答案:

答案 0 :(得分:0)

在您的。pro中,您必须设置包含路径位于srcml.h链接库

的.pro

# Path where srcml.h is
INCLUDEPATH += "path/to/library/include"

# Link your library
LIBS += -L"path/to/library/lib" -l[library_name]

我不知道图书馆的名称,请将[library_name]替换为图书馆名称。