ubuntu中的包含math 头文件的问题

软件和网站开发以及相关技术探讨
weihua2008
帖子: 448
注册时间: 2008-07-10 15:08

ubuntu中的包含math 头文件的问题

#1

帖子 weihua2008 » 2008-07-10 16:28

在测试头文件的加载时出现了点问题,希望各位指教!

#include<math.h>
#include<stdio.h>
int main(void)
{
double x=sqrt(3,2);
printf("The aquare root of 2.0 is: %f",x);
return 0;
}说:
sqrt: file not recognized: File format not recognized
collect2: ld 返回 1
第二次测试用math中的pow(x,y)函数,即求x的y次幂时也提示相似警告,
接下来我试着 安装math.h 结果又出现问题,如下:

正在读取软件包列表... 完成
正在分析软件包的依赖关系树
Reading state information... 完成
E: 无法找到软件包 math.h
希望各位高手指点
头像
牙签儿
帖子: 509
注册时间: 2007-06-30 0:27

#2

帖子 牙签儿 » 2008-07-10 17:38

确认你保存的文件格式是.c?
头像
kofshower
帖子: 1343
注册时间: 2007-03-13 11:23
联系:

#3

帖子 kofshower » 2008-07-10 17:42

libc6-dev: /usr/include/math.h
可见是这个包
这句话让我不理解:E: 无法找到软件包 math.h
是不是误用了apt-get install math.h????
上次由 kofshower 在 2008-07-10 22:26,总共编辑 2 次。
"We are all in the mud, but some of us are looking at the stars." (Oscar Wilde)
We are not born for ourselves.
人生天地间,并非为自己
Homepage:http://sites.google.com/site/polarisnotme/
头像
BigSnake.NET
帖子: 12522
注册时间: 2006-07-02 11:16
来自: 廣州
联系:

#4

帖子 BigSnake.NET » 2008-07-10 18:09

kofshower 写了:libc6-dev: /usr/include/math.h
可见是这个包
这句话让我不理解:E: 无法找到软件包 math.h
是不是误用了apt-get install math.h????
没有软件包叫 math.h,你应该安装 libc6-dev。
建议看看wiki
^_^ ~~~
要理解递归,首先要理解递归。

地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。
头像
牙签儿
帖子: 509
注册时间: 2007-06-30 0:27

#5

帖子 牙签儿 » 2008-07-10 18:17

代码: 全选

sudo apt-get install build-essential
weihua2008
帖子: 448
注册时间: 2008-07-10 15:08

#6

帖子 weihua2008 » 2008-07-10 20:54

首先谢谢各位的指点!
又一个问题:在终端的编辑下我想重新设置“粘切”和“复制”的快捷键,
本来粘切快捷键:Ctrl+shift+c
复制快捷键 :Ctrl+shift+V
我重新设置一下:
粘切快捷键:Ctrl+c
复制快捷键 :Ctrl+V
没承想重新设置后这俩个快捷键就不能用了 ,原来的和我设置的都失效了,
各位又知道的吗?
学无止境
头像
BigSnake.NET
帖子: 12522
注册时间: 2006-07-02 11:16
来自: 廣州
联系:

#7

帖子 BigSnake.NET » 2008-07-10 20:59

不可能的, Ctrl-C 和 Ctrl-V 有特别用途
^_^ ~~~
要理解递归,首先要理解递归。

地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。
weihua2008
帖子: 448
注册时间: 2008-07-10 15:08

#8

帖子 weihua2008 » 2008-07-10 21:03

很抱歉,我的快捷键问题已经搞清楚了,
修改后“编辑”项下会变成灰色,但是不影响它的功能!
不防各位也设置一下:
打开终端,在“编辑”项下有一个“快捷键”进去就可以设置各种快捷键了,很好的
粘切快捷键:Ctrl+c
复制快捷键 :Ctrl+V


共同进步!
weihua2008
帖子: 448
注册时间: 2008-07-10 15:08

#9

帖子 weihua2008 » 2008-07-10 21:08

3号楼主说的我试了,结果如下:
weihuachao@weihuachao:~/gcc.exp$ sudo apt-get install math
[sudo] password for weihuachao:
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
Reading state information... 完成
E: 无法找到软件包 math
weihuachao@weihuachao:~/gcc.exp$
你在看看还有改进的地方没有
weihua2008
帖子: 448
注册时间: 2008-07-10 15:08

#10

帖子 weihua2008 » 2008-07-10 21:11

牙签儿兄的再次回答是必须进行安装
sudo apt-get install build-essential
请说详细点
weihua2008
帖子: 448
注册时间: 2008-07-10 15:08

#11

帖子 weihua2008 » 2008-07-10 21:14

Ctrl-C 和 Ctrl-V 有特别用途?
麻烦你说详细点!
初学者,知道的少,
头像
kofshower
帖子: 1343
注册时间: 2007-03-13 11:23
联系:

#12

帖子 kofshower » 2008-07-10 22:26

kofshower 写了:libc6-dev: /usr/include/math.h
可见是这个包
这句话让我不理解:E: 无法找到软件包 math.h
是不是误用了apt-get install math.h????
我是说应该是 apt-get install libc6-dev
或是apt-get install build-essential
因为这个包相当于一个虚拟包,就是包的集合,里面包括了开发用的
libc6-dev | libc-dev, gcc (>= 4:4.1.1), g++ (>= 4:4.1.1), make, dpkg-dev (>= 1.13.5)
这些包
"We are all in the mud, but some of us are looking at the stars." (Oscar Wilde)
We are not born for ourselves.
人生天地间,并非为自己
Homepage:http://sites.google.com/site/polarisnotme/
头像
kofshower
帖子: 1343
注册时间: 2007-03-13 11:23
联系:

#13

帖子 kofshower » 2008-07-10 22:33

weihua2008 写了:Ctrl-C 和 Ctrl-V 有特别用途?
麻烦你说详细点!
初学者,知道的少,
Ctrl-C是给终端中的程序发中断signal
Ctrl-V没有用。
默认的终端键盘绑定emace样式的。
不喜欢可以用vim样式
"We are all in the mud, but some of us are looking at the stars." (Oscar Wilde)
We are not born for ourselves.
人生天地间,并非为自己
Homepage:http://sites.google.com/site/polarisnotme/
头像
BigSnake.NET
帖子: 12522
注册时间: 2006-07-02 11:16
来自: 廣州
联系:

#14

帖子 BigSnake.NET » 2008-07-11 9:07

kofshower 写了:
weihua2008 写了:Ctrl-C 和 Ctrl-V 有特别用途?
麻烦你说详细点!
初学者,知道的少,
Ctrl-C是给终端中的程序发中断signal
Ctrl-V没有用。
默认的终端键盘绑定emace样式的。
不喜欢可以用vim样式
Ctrl-V 是转义用的。。
^_^ ~~~
要理解递归,首先要理解递归。

地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。
头像
kofshower
帖子: 1343
注册时间: 2007-03-13 11:23
联系:

#15

帖子 kofshower » 2008-07-11 11:58

BigSnake.NET 写了:
kofshower 写了:
weihua2008 写了:Ctrl-C 和 Ctrl-V 有特别用途?
麻烦你说详细点!
初学者,知道的少,
Ctrl-C是给终端中的程序发中断signal
Ctrl-V没有用。
默认的终端键盘绑定emace样式的。
不喜欢可以用vim样式
Ctrl-V 是转义用的。。
我的错。没有意识到那^M之类的用C-V-M来画
"We are all in the mud, but some of us are looking at the stars." (Oscar Wilde)
We are not born for ourselves.
人生天地间,并非为自己
Homepage:http://sites.google.com/site/polarisnotme/
回复