LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1132|回复: 4

gcc 编译错误

[复制链接]
发表于 2008-1-24 23:11:03 | 显示全部楼层 |阅读模式
前天把整个系统更新了一下,结果出来一堆问题...写一个简单的程序,调用了math.h,然而在make的时候却报错:/usr/include/math.h:30: error: expected unqualified-id before string constant。
改成 include<cmath>却出现以下错误
/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/include/g++-v4/cmath:49: error: '#pragma' is not allowed here
/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/include/g++-v4/i686-pc-linux-gnu/bits/c++config.h:47: error: '__gnu_debug_def' is not a namespace-name
/usr/lib/gcc/i686-pc-linux-gnu/4.1.2/include/g++-v4/i686-pc-linux-gnu/bits/c++config.h:47: error: expected namespace-name before ';' token
不知道有哪位知道如何解决?十分 感谢!
发表于 2008-1-24 23:29:46 | 显示全部楼层
有math.h编译的时候要加-lm参加,连接数学库。
C++的要g++来编译。
using namespace std; 后面有分号。
回复 支持 反对

使用道具 举报

发表于 2008-1-24 23:34:30 | 显示全部楼层
也有更大的可能是部分函数库丢失,那试着重新编译gcc
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-1-24 23:54:04 | 显示全部楼层
gcc重新编译过了,我更新系统前用gcc 4.1.1,相同的程序,没有加-lm选项也没这个问题阿
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-1-24 23:55:46 | 显示全部楼层
而且加了还是有问题
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表