不使用QT IDE 使用windows(vs) linux(eclipse) 下开发

linux:

Eclipse配置

新建一个C/C++工程


添加一个CPP文件 main.cpp

写入

#include "stdio.h"
#include <QtWidgets/QApplication>
#include <QtWidgets/QLabel>
int main(int argc ,char * argv[])
{
	  QApplication app(argc,argv);
	  QLabel *label = new QLabel("Hello Qt!");
	  label->show();
	  printf("qt main");
	  return app.exec();
}


1添加qt的包含目录



编译提示错误 

error "You must build your code with position independent code if Qt was built with -reduce-relocations. "

解决方案 勾选 Position Indenpendent Code




编译错误 没有添加库

main.cpp:6: undefined reference to `QApplication::QApplication(int&, char**, int)

。。。。。。。。。。


解决方法。添加库文件




如果还提示Qtxxx so缺少依赖库。

libicui18n.so.48, needed by /home/xxxxxxxx/install/Qt/lib/libQt5Core.so, not found (try using -rpath or -rpath-link) 
and (from libQt5Core.so) a dozen errors like: 
/home/xxx/install/Qt/lib/libQt5Core.so:-1: error: undefined reference to ucnv_fromUnicode_48' 

解决








windows:


windows下可以通过qt addon 插件。也可以像linux上面一样 添加你自己的cpp然后通过rcc uic moc 编译需要的文件。然后构建



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值