我写了一个小 c 文件来测试 DRMAA,但它一直告诉我我使用的 DRMAA 函数没有定义。我在 C 代码中包含了 drmaa.h 文件。当我使用 -idrmaa 时出现此错误:
[mkatouzi@argo-1 ~]$ cc -o drmtest -I$SGE_ROOT/include/ -ldrmaa -ldl drmtest.c
/usr/bin/ld: cannot find -ldrmaa
DRMAA 头文件位于此路径中:$SGE_ROOT/include/
如果我在没有 -ldrmaa 的情况下编译文件,我会收到此错误:
[mkatouzi@argo-1 ~]$ cc -o drmtest -I$SGE_ROOT/include/ drmtest.c
/tmp/cclsPr9O.o: In function `main':
drmtest.c:(.text+0x3c): undefined reference to `drmaa_init'
drmtest.c:(.text+0x83): undefined reference to `drmaa_exit'
collect2: ld returned 1 exit status
我正在使用我学校的 UNIX 系统,我对它很陌生。谁能帮我这个?
这是我的 drmtest.c 文件:
#include <stdio.h>
#include "drmaa.h"
int main (int argc, char **argv) {
char error[DRMAA_ERROR_STRING_BUFFER];
int errnum = 0;
errnum = drmaa_init (argv[0], error, DRMAA_ERROR_STRING_BUFFER);
if (errnum != DRMAA_ERRNO_SUCCESS) {
fprintf (stderr, "Couldn't init DRMAA library: %s\n", error);
return 1; }
/* Do Stuff */
errnum = drmaa_exit (error, DRMAA_ERROR_STRING_BUFFER);
if (errnum != DRMAA_ERRNO_SUCCESS) {
fprintf (stderr, "Couldn't exit DRMAA library: %s\n", error);
return 1; }
return 0;
}