当我运行以下命令时,我正在尝试使用共享对象库交叉编译到mips64:
toby@cbmFinal:~/x-tools/mips64-n64-linux-gnu/bin$ ./mips64-n64-linux-gnu-gcc -I /home/toby/Downloads/net-snmp-5.5.2.1/include/net-snmp/ -L /usr/lib64/libnetsnmp.so ~/BsDiagnostics/snmpdemoapp.c -o snmpdemoapp
它会抛出错误,说它无法找到头文件:
/home/toby/BsDiagnostics/snmpdemoapp.c:1:38: error: net-snmp/net-snmp-config.h: No such file or directory
/home/toby/BsDiagnostics/snmpdemoapp.c:2:40: error: net-snmp/net-snmp-includes.h: No such file or directory
/home/toby/BsDiagnostics/snmpdemoapp.c: In function 'main':
/home/toby/BsDiagnostics/snmpdemoapp.c:14: error: 'netsnmp_session' undeclared (first use in this function)
/home/toby/BsDiagnostics/snmpdemoapp.c:14: error: (Each undeclared identifier is reported only once
/home/toby/BsDiagnostics/snmpdemoapp.c:14: error: for each function it appears in.)
/home/toby/BsDiagnostics/snmpdemoapp.c:14: error: expected ';' before 'session'
等等
我已经检查过dir并且他们都在那里,我也可以使用-include手动完成它们但是然后有一堆其他标题我不能全部包括。
toby@cbmFinal:~/Downloads/net-snmp-5.5.2.1/include/net-snmp$ ls
agent definitions.h mib_api.h.gch output_api.h session_api.h.gch utilities.h
config_api.h library net-snmp-config.h pdu_api.h snmpv3_api.h varbind_api.h
config_api.h.gch machine net-snmp-config.h.in pdu_api.h.gch system varbind_api.h.gch
data_access mib_api.h net-snmp-includes.h session_api.h types.h version.h
任何帮助将不胜感激。谢谢!
答案 0 :(得分:1)
已修复,是语法错误。
正确的命令是:
toby@cbmFinal:~/x-tools/mips64-n64-linux-gnu/bin$ ./mips64-n64-linux-gnu-gcc -I/home/toby/Downloads/net-snmp-5.5.2.1/include/ -L/usr/lib64 -lnetsnmp ~/BsDiagnostics/snmpdemoapp.c -o snmpdemoapp