Linux 下调用动态链接库
现在有别人给的,有.h .cpp .a .so文件,我要怎么调用呢?测试文件:main.cpp
作者: sishuiqingling 发布时间: 2011-05-31
http://hi.baidu.com/mgqw/blog/item/120a1d3dab7f1f03bba16710.html
作者: thefirstz 发布时间: 2011-05-31
就可以了
*.a就是别人给你的库文件。编译生成test
作者: yong_f 发布时间: 2011-05-31
了解下动态库和静态库就会使用了,自己搜索下,或简单看看下面文章
http://hi.baidu.com/mgqw/blog/item/120a1d3dab7f1f03bba16710.html
我当然看过,搜索过相关的文章,也了解了动态与静态库,而且我按着网上的人说的方法自己创建和生成静态库,动态库了,并且已经用简单的文件成功调用了,可是,同样的编译和调用方法,用在别人给的这个上,就没有作用,编译都编译不过去
作者: sishuiqingling 发布时间: 2011-05-31
g++ -o test main.cpp *.a
就可以了
*.a就是别人给你的库文件。编译生成test
编译不过去啊……有错误……
作者: sishuiqingling 发布时间: 2011-05-31
C++中有name-mangling,动态库尽量用纯C版本的
作者: thefirstz 发布时间: 2011-05-31
这是其中错误之一的格式,好像没有连接上动态库……
作者: sishuiqingling 发布时间: 2011-05-31
g++ -o test main.cpp *.a
提示什么?
作者: justkk 发布时间: 2011-05-31
export LANG=C
g++ -o test main.cpp *.a
提示什么?
一样的错误,不过没有乱码了
作者: sishuiqingling 发布时间: 2011-05-31
.h error:expected constructor. destructor. or type conversion before token
作者: justkk 发布时间: 2011-05-31
作者: sishuiqingling 发布时间: 2011-05-31
.h error:expected constructor. destructor. or type conversion before token
.h error:expected constructor. destructor. or type conversion before '(' token
.h error:'WORD' does not name a type
…………
等等错误,我真不知道该怎么弄了,从哪里入手
作者: sishuiqingling 发布时间: 2011-05-31
类型不识别
作者: justkk 发布时间: 2011-05-31
缺少头文件吧
类型不识别
有头文件啊,可是为什么会这样?
作者: sishuiqingling 发布时间: 2011-05-31
作者: michael1112 发布时间: 2011-05-31