Ubuntu下函数使用“math.h"编译出现的问题
2014-11-26 20:32
701 查看
今天在Ubuntu下编译函数(函数中用到了"math.h"),编译时出现下面问题
其解决方法是:只需要在.c后加上 -lm即可。
其原因是因为Ubuntu下的数学函数通常在lib目录下面(即libm.so库函数),-lm就告诉了编译器,我们使用的数学函数应该到lib下的库函数寻找,从而就不会出现编译错误了。
其解决方法是:只需要在.c后加上 -lm即可。
其原因是因为Ubuntu下的数学函数通常在lib目录下面(即libm.so库函数),-lm就告诉了编译器,我们使用的数学函数应该到lib下的库函数寻找,从而就不会出现编译错误了。
相关文章推荐
- Ubuntu下使用ap-hotspot出现“Another process is already running"问题的解决方案
- 解决ubuntu编译内核uImage出现问题"mkimage" command not found - U-Boot images will not be built问题
- 使用dsoframer控件出现"Unable to display the inactive document. Click here to reactivate the document."的问题
- 已安全化的ActiveX控件卸载时出现"DllUnregisterServer函数出错,错误代码:0x80070002"问题解决
- Android中使用AlertDialog,使用函数setButton()出现的关于“new OnClickListener"错误
- 使用eclipse编译出现java.lang.NoClassDefFoundError Exception in thread "main"
- 使用Vimdiff出现“Cannot read temp file"的问题
- 用gcc编译.cpp文件可能出现"undefined reference to `__gxx_personality_v0'"问题的解决
- 使用vs2012配置opencv编译出现问题:error C4996: 'fopen': This function or variable may be unsafe.
- 学习 "使用cocos2d-x3.0和物理引擎实现碰撞检测" 中出现的一个问题
- nginx升级到 0.8.53 之后,使用老的配置出现duplicate MIME type "text/html"问题的解决办法
- Ubuntu 12.04 经常弹出"检测到系统程序出现问题"解决方法
- 程序编译是出现"field has incomplete type"问题的解决
- 使用<input type="text" value=<%=str%>>出现取值不全的问题
- 使用dsoframer控件出现"Unable to display the inactive document. Click here to reactivate the document."的问题
- Enterprise Library- Data Block使用oracle存储过程,字符串参数传入值为""时出现问题的解决
- 使用了hibernate的项目发布时tomcat转weblogic 11出现"标示符无效"的问题
- mybatis 使用foreach时出现"The expression 'list' evaluated to a null value"问题
- Ubuntu下使用ap-hotspot出现“Another process is already running"问题的解决方案
- ubuntu12.04.4下出现"(sublime:12386): Gtk-WARNING **: Failed to load type module: (null)"问题及解决方法