Ubuntu动态链接库问题
来源:互联网 发布:三星galaxy j7网络 编辑:程序博客网 时间:2024/05/16 11:28
在CentOS上,Makefile中动态链接库的位置放在源码文件名的前面和后面都可以,而在ubuntu中LIBS必须放到源文件名的后面,否则会碰到下面的问题:
I am currently using gcc to compile and I need to use
<math.h>
. Problem is that it won't recognize the library. I have also tried -lm
and nothing. The function I tried to use was ceil()
and I get the following error:: undefined reference to `ceil'collect2: ld returned 1 exit status
I am using the latest Ubuntu and math.h is there. I tried to use -lm
in a different computer and it work perfectly.
Does anyone know how to solve this problem?
I did include <math.h>
. Also, the command I used was:
gcc -lm -o fb file.c
up vot
Take this code and put it in a file ceil.c
:
#include <math.h>#include <stdio.h>int main(void){ printf("%f\n", ceil(1.2)); return 0;}
Compile it with:
$ gcc -o ceil ceil.c$ gcc -o ceil ceil.c -lm
One of those two should work. If neither works, show the complete error message for each compilation. Note that -lm
appears after the name of the source file (or the object file if you compile the source to object before linking).
Try changing the relevant lines to this:
LDFLAGS=`pkg-config --libs-only-L --libs-only-other $(PACKAGES)`LIBS=`pkg-config --libs-only-l $(PACKAGES)`# ..../main: ./main.o $(LD) $(LDFLAGS) ./main.o -o ./main $(LIBS)
- Ubuntu动态链接库问题
- 动态库链接问题!!!
- ubuntu 动态链接库修复
- 动态库链接的问题
- Symbian 动态链接库问题
- 动态库链接问题LNK2019
- ubuntu下动态链接库的使用
- ubuntu下链接动态库失败
- ubuntu下导入动态链接库
- Ubuntu linux 添加动态链接库路径
- ubuntu下动态链接库小计
- JNative调用动态链接库问题(SOS)
- Wince MFC动态链接库的问题
- Linux动态链接库搜索路径问题
- linux动态链接库遇到的问题
- so动态链接库编译问题
- Linux gdb 动态链接库 so 问题
- 关于动态链接库哪些问题
- ORACLE 目录磁盘空间不足解决方法
- Part02_MySQL对数据的基本操作
- C 调试
- 向着高情商迈进!
- 网页JS简繁体字转换
- Ubuntu动态链接库问题
- Oracle java.sql.SQLException: 无法从套接字读取更多的数据
- Gdiplus 读取并显示 Gif
- C++学习笔记第一天:熟悉C++,解决“Cannot find or open the PDB file”问题
- android 解析json数据格式
- how to install xen on ubuntu 11.10 (Oneiric)
- 代码复用之一 ——提取代码
- java 继承中静态语句块 非静态语句块 构造函数 的分析
- 评测几种字符串叠加的速度:string直接相加, String.Format, StringBuilder的速度