我正在尝试制作一个与 TOSSIM(TinyOS 模拟器)一起使用的 NesC 程序,包括 gmp 库这是我的代码示例
event void Boot.booted()
{
//dbg("MAPC", "Booted\n");
//int g = 2;
const char * const num = "10387922662657137735272585565990678424704150824246588991894422884684285337052622755228646547137908394766337363629003511269209591656314972254747436173398683";
int err;
mpz_t n;
err = mpz_init_set_str(n, num, 10);
dbg("MAPC","%d",sizeof(n));
mpz_clear(n);
}
使用make micaz sim
或env "CFLAGS = -lgmp" make micaz sim
当我尝试通过 python 脚本执行它时,编译运行良好,我收到此错误:
Traceback (most recent call last):
File "kdk.py", line 4, in <module>
from TOSSIM import *
File "/opt/tinyos-2.1.2/apps/MAP/TOSSIM.py", line 7, in <module>
import _TOSSIM
ImportError: /opt/tinyos-2.1.2/apps/MAP/_TOSSIMmodule.so: undefined symbol: __gmpz_init_set_str