iRODS插件编译问题

时间:2017-05-19 08:33:39

标签: c++ makefile include

我目前正在开展一个包含使用iRODS复合类型的项目。

无论如何,我的Makefile只有3个指令。一个用于创建共享库,第二个用于创建测试工具可执行文件,第三个用于清理。

第一个和第三个正常工作,但每当我尝试编译test_harness可执行文件时,我得到一个非常奇怪的错误,它有一个未定义的rodLog引用。

但它不可能,因为我的VSCode配置已包含路径中的所有内容。

来自c_cpp_properties.json的片段

{
            "name": "Linux",
            "includePath": [
                "${workspaceRoot}",
                "/usr/include/c++/6",
                "/usr/include/x86_64-linux-gnu/c++/6",
                "/usr/local/include",
                "/usr/lib/clang/4.0.0/include",
                "/usr/include",
                "/usr/include/x86_64-linux-gnu",
                "/usr/include/irods",
                "/usr/include/irods/boost"
            ],
            "defines": [],
            "browse": {
                "path": [
                    "/usr/include/c++/6",
                    "/usr/include/x86_64-linux-gnu/c++/6",
                    "/usr/local/include",
                    "/usr/lib/clang/4.0.0/include",
                    "/usr/include",
                    "/usr/include/x86_64-linux-gnu",
                    "/usr/include/irods",
                    "/usr/include/irods/boost"

                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            }
        },

我的 Makefile 如下所示:

GCC = g++
INC=-I/usr/include/irods/ -I/usr/include/irods/boost/
LIB=-L/usr/lib/irods/
all:
    ${GCC} ${INC} ${LIB} -g -Wall -Dlinux_platform -fPIC -shared -o libdsnet.so libirods_dsnet.cpp \
    s3_api.cpp \
    cso_api.cpp \
    json_commands.cpp \
    -ls3 \
    -ljansson \
    -lxml2 \
    -lcurl \
    -lpthread

test_harness:
    ${GCC} ${INC} -Dlinux_platform -fPIC -o test_harness test_harness.cpp json_commands.cpp cso_api.cpp \
    s3_api.cpp \
    -lpthread \
    -ljansson \
    -lcrypto \
    -lssl \
    -ls3 \
    -lcurl



clean:
    @rm -f libdsnet.so
    @rm -f test_harness

我遇到的错误是:

make test_harness
g++ -I/usr/include/irods/ -I/usr/include/irods/boost/ -Dlinux_platform -fPIC -o test_harness test_harness.cpp json_commands.cpp cso_api.cpp \
s3_api.cpp \
-lpthread \
-ljansson \
-lcrypto \
-lssl \
-ls3 \
-lcurl
/tmp/ccEbKGJ9.o: In function `responseCompleteCallback(S3Status, S3ErrorDetails const*, void*)':
s3_api.cpp:(.text+0x62): undefined reference to `rodsLog'

但我把它包含在显示错误的文件+函数中:

#include <stdlib.h>
#include <string.h>

#include "irods_error.hpp"
#include "rodsLog.hpp"
#include "s3_api.hpp"
#include "rodsErrorTable.hpp"
#include <libs3.h>

static void responseCompleteCallback(
    S3Status status,
    const S3ErrorDetails *error,
    void *callbackData)
{
    int i;

    statusG = status;
    if( status != S3StatusOK ) {
        rodsLog( LOG_NOTICE, "  S3Status: [%s] - %d\n", S3_get_status_name( status ), (int) status );
    }
    if (error && error->message) {
        rodsLog( LOG_NOTICE,  "  Message: %s\n", error->message);
    }
    if (error && error->resource) {
        rodsLog( LOG_NOTICE,  "  Resource: %s\n", error->resource);
    }
    if (error && error->furtherDetails) {
        rodsLog( LOG_NOTICE, "  Further Details: %s\n", error->furtherDetails);
    }
    if (error && error->extraDetailsCount) {
        rodsLog( LOG_NOTICE,  "%s", "  Extra Details:\n");

        for (i = 0; i < error->extraDetailsCount; i++) {
            rodsLog( LOG_NOTICE,  "    %s: %s\n", error->extraDetails[i].name, error->extraDetails[i].value);
        }
    }
}

问题是,为共享对象编译的代码非常相似,但不是test_harness,我无法找到原因。 任何帮助表示赞赏。

0 个答案:

没有答案