我在我的 Mac 10.7 上安装了 proj.4 库和自制软件(使用 gcc-4.2)。尝试编译以下代码时:
#include <proj_api.h>
int main(void) {
projPJ pj_merc;
pj_merc = pj_init_plus("+proj=merc");
pj_free(pj_merc);
return 0;
}
我收到此错误:
$ gcc-4.2 test.c
Undefined symbols for architecture x86_64:
"_pj_init_plus", referenced from:
_main in cccf4vey.o
"_pj_free", referenced from:
_main in cccf4vey.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
编辑:
库文件是 64 位(gcc-4.2 -m32 test.c
导致相同的错误):
$ file /usr/local/lib/libproj.dylib
/usr/local/lib/libproj.dylib: Mach-O 64-bit dynamically linked shared library x86_64
有什么想法有什么问题吗?
谢谢!