0

globus ツールキットの Web サイトにあるサンプル ドライバー プログラムを実行しようとしています。これはプログラムです:

#include "globus_xio.h"

int main(int argc,char *argv[])
{
    globus_result_t                 res;
    char *                          driver_name;
    globus_xio_driver_t             driver;
    globus_xio_stack_t              stack;
    globus_xio_handle_t             handle;
    globus_size_t                   nbytes;
    char *                          contact_string = NULL;
    char                            buf[256];

    contact_string = argv[1];
    driver_name = argv[2];

    globus_module_activate(GLOBUS_XIO_MODULE);
    res = globus_xio_driver_load(driver_name,&driver);
    assert(res == GLOBUS_SUCCESS);

    res = globus_xio_stack_init(&stack, NULL);
    assert(res == GLOBUS_SUCCESS);
    res = globus_xio_stack_push_driver(stack, driver);
    assert(res == GLOBUS_SUCCESS);

    res = globus_xio_handle_create(&handle, stack);
    assert(res == GLOBUS_SUCCESS);

    res = globus_xio_open(handle, contact_string, NULL);
    assert(res == GLOBUS_SUCCESS);

    do
    {
        res = globus_xio_read(handle, buf, sizeof(buf) - 1, 1, &nbytes, NULL);
        if(nbytes > 0)
        {
            buf[nbytes] = '\0';
            fprintf(stderr, "%s", buf);
        }
    } while(res == GLOBUS_SUCCESS);

    globus_xio_close(handle, NULL);

    globus_module_deactivate(GLOBUS_XIO_MODULE);

    return 0;
}

コマンドを使用してこれをコンパイルすると
cc -I /usr/include/globus globus_xio_example.c
、次のエラーが発生します

/tmp/ccLMLlIi.o: 関数 `main' 内:
globus_xio_example.c:(.text+0x57): 「globus_i_xio_module」への未定義の参照
globus_xio_example.c:(.text+0x5c): 「globus_module_activate」への未定義の参照
globus_xio_example.c:(.text+0x75): 「globus_xio_driver_load」への未定義の参照
globus_xio_example.c:(.text+0xb1): 「globus_xio_stack_init」への未定義の参照
globus_xio_example.c:(.text+0xf2): 「globus_xio_stack_push_driver」への未定義の参照
globus_xio_example.c:(.text+0x133): 「globus_xio_handle_create」への未定義の参照
globus_xio_example.c:(.text+0x179): 「globus_xio_open」への未定義の参照
globus_xio_example.c:(.text+0x1d1): 「globus_xio_read」への未定義の参照
globus_xio_example.c:(.text+0x22b): 「globus_xio_close」への未定義の参照
globus_xio_example.c:(.text+0x230): 「globus_i_xio_module」への未定義の参照
globus_xio_example.c:(.text+0x235): 「globus_module_deactivate」への未定義の参照
collect2: ld が 1 つの終了ステータスを返しました
4

2 に答える 2

0

これを試してgcc -I /usr/include/globus globus_xio_example.c -lglobus_xio -lglobus_common

于 2015-02-27T16:27:40.540 に答える