在编译时遇到错误? [英] Getting errors while compiling?

查看:366
本文介绍了在编译时遇到错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在编译我的代码时收到这些错误。我有所有的头下面的用户/ include

I am getting these errors when I am compiling my code. I have all the headers under user/include

g++ -Ip_appmanager/inc -Icore/inc p_appmanager/src/appmanager_process.cpp -o p_appmanager/obj/appmanager -lpthread -lparser
p_appmanager/src/appmanager_process.cpp: In function ‘int main(int, char**)’:
p_appmanager/src/appmanager_process.cpp:33:21: error: ‘getpid’ was not declared in this scope
p_appmanager/src/appmanager_process.cpp:101:19: error: ‘fork’ was not declared in this scope
p_appmanager/src/appmanager_process.cpp:105:70: error: ‘execl’ was not declared in this scope
p_appmanager/src/appmanager_process.cpp:109:19: error: ‘getppid’ was not declared in this scope
p_appmanager/src/appmanager_process.cpp:124:19: error: ‘fork’ was not declared in this scope
p_appmanager/src/appmanager_process.cpp:128:61: error: ‘execl’ was not declared in this scope
p_appmanager/src/appmanager_process.cpp:132:19: error: ‘getppid’ was not declared in this scope
p_appmanager/src/appmanager_process.cpp:147:19: error: ‘fork’ was not declared in this scope
p_appmanager/src/appmanager_process.cpp:151:73: error: ‘execl’ was not declared in this scope
p_appmanager/src/appmanager_process.cpp:155:19: error: ‘getppid’ was not declared in this scope
p_appmanager/src/appmanager_process.cpp:170:19: error: ‘fork’ was not declared in this scope
p_appmanager/src/appmanager_process.cpp:175:70: error: ‘execl’ was not declared in this scope
p_appmanager/src/appmanager_process.cpp:179:19: error: ‘getppid’ was not declared in this scope
p_appmanager/src/appmanager_process.cpp: In function ‘void* pingThread(void*)’:
p_appmanager/src/appmanager_process.cpp:302:11: error: ‘sleep’ was not declared in this scope
p_appmanager/src/appmanager_process.cpp: In function ‘void* fifoThread(void*)’:
p_appmanager/src/appmanager_process.cpp:815:22: error: ‘fork’ was not declared in this scope
p_appmanager/src/appmanager_process.cpp:818:72: error: ‘execl’ was not declared in this scope
p_appmanager/src/appmanager_process.cpp:842:64: error: ‘execl’ was not declared in this scope
p_appmanager/src/appmanager_process.cpp:865:72: error: ‘execl’ was not declared in this scope
make: *** [all] Error 1

我的内核版本是Linux amit-bhaira 3.8.0-26-generic#38- Ubuntu SMP Mon Jun 17 21:46:08 UTC 2013 i686 i686 i686 GNU / Linux 。同样的代码在另一台linux机器上运行。

my kernel version is "Linux amit-bhaira 3.8.0-26-generic #38-Ubuntu SMP Mon Jun 17 21:46:08 UTC 2013 i686 i686 i686 GNU/Linux" . Same code is running on another linux machine.

请帮助我解决这个问题。

please help me to fix this problem.

谢谢。

推荐答案

添加 #include< unistd.h>

它在其他平台上工作,因为它们正在使用旧版本的gcc(<4.7)进行编译,在某些系统标题中意外包含unistd.h。

It works on other platforms because they are compiling with an old version of gcc (<4.7) which accidentally included unistd.h in some system headers.

这篇关于在编译时遇到错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆