免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3996 | 回复: 3

[C++] QT Creator 使用libssh2出现错误: extern "C" { [复制链接]

论坛徽章:
0
发表于 2014-07-12 10:07 |显示全部楼层
本帖最后由 轻逐微风 于 2014-07-12 10:07 编辑

我是C++/QT新手 请大家帮我看看,谢谢

编译环境:windows7(64)+QT mingw

libssh2是使用VS2010编译的
参照这个帖子:http://windrocblog.sinaapp.com/?p=888



错误信息:
D:\qtObject\libssh2-1.4.3\include\libssh2.h:88: error: expected unqualified-id before string constant
extern "C" {
D:\Qt\Qt5.3.1\Tools\mingw482_32\i686-w64-mingw32\include\excpt.h:11: error: expected '}' before end of line
#pragma pack(push,_CRT_PACKING)
D:\Qt\Qt5.3.1\Tools\mingw482_32\i686-w64-mingw32\include\excpt.h:-1: At global scope:
D:\Qt\Qt5.3.1\Tools\mingw482_32\i686-w64-mingw32\include\excpt.h:11: error: expected declaration before end of line


QQ截图20140711185154.png

论坛徽章:
59
2015年亚洲杯之约旦
日期:2015-01-27 21:27:392015年亚洲杯之日本
日期:2015-02-06 22:09:41拜羊年徽章
日期:2015-03-03 16:15:432015年辞旧岁徽章
日期:2015-03-03 16:54:152015年迎新春徽章
日期:2015-03-04 09:50:282015元宵节徽章
日期:2015-03-06 15:50:392015年亚洲杯之阿联酋
日期:2015-03-19 17:39:302015年亚洲杯之中国
日期:2015-03-23 18:52:23巳蛇
日期:2014-12-14 22:44:03双子座
日期:2014-12-10 21:39:16处女座
日期:2014-12-02 08:03:17天蝎座
日期:2014-07-21 19:08:47
发表于 2014-07-12 10:11 |显示全部楼层
楼主你把C++代码当做C代码来编译了

论坛徽章:
0
发表于 2014-07-12 10:40 |显示全部楼层
回复 2# folklore


    请问如何解决呢

libssh2是C的,我的代码是C++的

论坛徽章:
0
发表于 2014-07-12 11:01 |显示全部楼层
#include <libssh2_config.h>
#include <libssh2.h>

int rct=0;
rct=libssh2_init(0);
qDebug()<<rct;
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP