+ -
当前位置:首页 → 问答吧 → Linker error - undefined reference to `sem_i in codeblocks:<

Linker error - undefined reference to `sem_i in codeblocks:<

时间:2010-11-03

来源:互联网

在eclipse中开发c++,调用socket 的send函数报没权限,在命令行中使用sudo可以运行,请问如何打开权限?谢谢。

作者: sailuer   发布时间: 2010-11-03

无源码无真相

作者: BigSnake.NET   发布时间: 2010-11-03

发送的地方代码如下:
if ( (s = socket(AF_INET, SOCK_RAW, proto->p_proto)) < 0) {
return 1;
}

运行到此处时s == -1, eorr:Operation not permitted

我将生成的可执行文件在命令行直接执行报同样的错误,但是加上sudo执行就没问题了,我是在eclipse下开发的,请问如何打开权限?谢谢。

作者: sailuer   发布时间: 2010-11-03

在eclipse不懂,但是在命令行
代码:
sudo gcc -Wall xxx.c -o xxx

代码:
sudo chmod u+s xxx

作者: iSIX   发布时间: 2010-11-03

proto->p_proto 这里是什么

作者: BigSnake.NET   发布时间: 2010-11-03

你开的端口号呢?

作者: HuntXu   发布时间: 2010-11-03