找不到头文件,既然头文件还在,那就是路径设置了,在工程属性里面找到包含文件路径,将你需要的头文件所在路径添加进去就行
Ⅱ qtcreator可以编译普通c++文件吗
打开QtCreator,文件->新建文件或项目->Application->Qt 控制台应用
建好工程之后,在main.cpp
文件中就可以编写C++控制台应用程序了
譬如:main.cpp内容如下:
#include<QCoreApplication>
#include<iostream>
intmain(intargc,char*argv[])
{
QCoreApplicationa(argc,argv);
std::cout<<"HelloWorld!"<<std::endl;
returna.exec();
}
执行结果:
与普通C++工程无区别
Ⅲ 如何利用QTcreator 开发Wt程序
从一个简单的helloword开始吧
pro文件
#-------------------------------------------------
#
# Project created by QtCreator 2010-11-18T12:10:20
#
#-------------------------------------------------
QT -= core
QT -= gui
TARGET = hello.wt
LIBS += -L/usr/local/lib -lwt -lwthttp
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
main.cpp
#include <Wt/WApplication>
#include <Wt/WBreak>
#include <Wt/WContainerWidget>
#include <Wt/WLineEdit>
#include <Wt/WPushButton>
#include <Wt/WText>
#include <boost/version.hpp>
using namespace Wt;
/*
* A simple hello world application class which demonstrates how to react
* to events, read input, and give feed-back.
*/
class HelloApplication : public WApplication
{
public:
HelloApplication(const WEnvironment& env);
private:
WLineEdit *nameEdit_;
WText *greeting_;
void greet();
};
/*
* The env argument contains information about the new session, and
* the initial request. It must be passed to the WApplication
* constructor so it is typically also an argument for your custom
* application constructor.
*/
HelloApplication::HelloApplication(const WEnvironment& env)
: WApplication(env)
{
setTitle("Hello"); // application title
root()->addWidget(new WText("Your name, please ? ")); // show some text
nameEdit_ = new WLineEdit(root()); // allow text input
nameEdit_->setFocus(); // give focus
WPushButton *b = new WPushButton("Greet me.", root()); // create a button
b->setMargin(5, Left); // add 5 pixels margin
root()->addWidget(new WBreak()); // insert a line break
greeting_ = new WText(root()); // empty text
/*
* Connect signals with slots
*
* - simple Wt-way
*/
b->clicked().connect(this, &HelloApplication::greet);
/*
* - using an arbitrary function object (binding values with boost::bind())
*/
nameEdit_->enterPressed().connect
(boost::bind(&HelloApplication::greet, this));
}
void HelloApplication::greet()
{
/*
* Update the text, using text input into the nameEdit_ field.
*/
greeting_->setText("Hello there, " + nameEdit_->text());
}
WApplication *createApplication(const WEnvironment& env)
{
/*
* You could read information from the environment to decide whether
* the user has permission to start a new application
*/
return new HelloApplication(env);
}
int main(int argc, char **argv)
{
/*
* Your main method may set up some shared resources, but should then
* start the server application (FastCGI or httpd) that starts listening
* for requests, and handles all of the application life cycles.
*
* The last argument to WRun specifies the function that will instantiate
* new application objects. That function is executed when a new user surfs
* to the Wt application, and after the library has negotiated browser
* support. The function should return a newly instantiated application
* object.
*/
return WRun(argc, argv, &createApplication);
}
这就是helloword 的工程文件
现在编译肯定是无法运行的
然后在运行环境中添加wt的共享库地址 好了 现在打开浏览器 输入0.0.0.0:8080 点击编译运行
成功 ,这样开发起来效率不知道高出n倍吧,诶,不知道wt 什么时候才能在国内普及呢
Ⅳ Qt在vs下创建工程,然后想用QtCreator打开这个工程,应该怎么办
右键点击对应项目,选择 Create basic .pro File ,弹出的框去掉没用的勾选,然后点击OK生成,再打开QT Creator 导入刚才的.pro项目文件
Ⅳ VS下的QT工程怎么转换成QTCreator工程
qt也是c++的一个库,不知道你是什么意思。
是指的把用标准STL库编写的程序移植成依赖qt库的代码
还是指的是把vs建立的qt工程移植成qtcreator打开需要的pro管理文件。
Ⅵ 用QtCreator 创建的工程用vc能打开吗
可以,打开QT的命令行工具,CD到工程所有目录(有.PRO的那个目录),然后qmake -tp vc,就会生成一个.vcproj,用VS打开就行了. 也可以,在Visual Studio中装个Qt Visual Studio Integration插件后后直接导入.PRO文件也可~`` 答题不容易,大家互相帮助,望采纳,谢谢!
Ⅶ 如何使用qtcreator linux
安装
后得到大小 47.2 Mb 的安装文件 qt-creator-linux-x86_64-opensource-1.3.0.bin,在 Linux 上安装如下:
chmod u+x ./qt-creator-linux-x86_64-opensource-1.3.0.bin
./qt-creator-linux-x86_64-opensource-1.3.0.bin
这时候,启动了 Setup Qt Creator 欢迎安装对话框,点击“Next”->
协议许可界面,选择“I accept the agreement”,点击“Next” ->
选择 Qt Creator 安装目录对话框。作者选择的是 /home/defonds/TOOLS/qtcreator/qtcreator-1.3.0,点击“Next” ->
准备安装界面,点击“Next” ->
安装结束,点击“Finish”。
Qt Creator 使用
新建项目 HelloWorld
启动桌面上的 Qt Creator。新建工程 HelloWorld,菜单点击“File” -> New File or Project -> Projects 中选择 Empty Qt4 Project -> OK -> 项目名键入 HelloWorld,工作台随意,作者选择的是 /home/defonds/cpp/qt , Next -> Finish。
Ⅷ 请教QT大神,在QTCreator创建一个QT插件工程,创建成功,但是构建时报以下这些错,如何解决求助
先确认一下系统是否已安装make工具吧。看看自己在终端上面试试能不能调用make命令。
Ⅸ 想问问有没有ubuntu下用opencv的,我是用Qt做为一个编辑器,写代码的时候也把头文件写对了
我在网上查找安装方法时有两种方式,第一种方案在第三步测试的时候没有成功,不知道问题出在哪里,换用了第二种方式。如果直接用第二种方式安装不成功,可以试试进行第一种方式的第2步。
安装环境是Ubuntu 10.04,内核版本2.6.32.22。OpenCV版本为2.4.3。
第一种方式,参考org.cn/index.php/Debian%E4%B8%8B%E5%AE%89%E8%A3%85
1.更新下载更新软件包列表信息
$ apt-get update
2.查询OpenCV相关软件包
查询获得的内容和OpenCV软件包版本有关
复制代码
$ apt-cache search opencv
libcv-dev - development files for libcv
libcv4 - computer vision library
libcvaux-dev - development files for libcvaux
libcvaux4 - computer vision extension library
libhighgui-dev - development files for libhighgui
libhighgui4 - computer vision GUI library
opencv-doc - OpenCV documentation and examples
python-opencv - Python bindings for the computer vision library
harpia - Image Processing/Computer Vision Automatic Prgm. Tool
复制代码
3.测试
进入软件目录/sample/cpp,执行以下命令
g++ `pkg-config opencv --libs --cflags opencv` drawing.cpp -o drawing
成功编译并能执行表示安装成功。
第二种方式,OpenCV 2.4.3同样适用,参考自http://www.linuxidc.com/Linux/2012-12/75641.htm
1.安装必要的依赖包
这一步我略去了,因为原文中提到的ffmepg1我并不需要安装,并且我是从第一种方式转过来的,就没有安装这些包,不过还是列在下面:
sudo apt-get install build-essential libgtk2.0-dev l www.hbbz08.com ibjpeg62-dev libtiff4-dev libjasper-dev libopenexr-dev cmake python-dev python-numpy libtbb-dev libeigen2-dev yasm libfaac-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev
2.安装OpenCV
(1)下载OpenCV 2.4.3 http://sourceforge.net/projects/opencvlibrary/
(2) tar -xvf OpenCV-2.4.3.tar.bz2
(3)将其复制到 “ home/你的计算机名/”下;
(4)cd OpenCV-2.4.3
(5)mkdir release
(6)cd release
(7)
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_TBB=ON -D WITH_V4L=OFF -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON ..
如果没有cmake,apt-get install就行
(8) make
(9)sudo make install
3.添加库的路径
(1)sudo gedit /etc/ld.so.conf.d/opencv.conf
文件可能需要创建,添加下面内容并保存
/usr/local/lib
(2)sudo ldconfig
(3) sudo gedit /etc/environment
添加下面内容
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
这时,再回到OpenCV-2.4.3/sample/cpp下时,用第一种方式的测试方法,drawing.cpp文件就能正确编译,而且也可以通过生成的文件看到效果了。
2013.1.6更新:QT调用openCV库(ixunjishu/qianrushipeixun/959.html)
QT的安装过程就略去了,注意需要QT设计器和QTcreator,前者我是下源码编译的,后者用软件中心装的。
配置QT, sudo gedit /usr/share/qt4/mkspecs/default/qmake.conf
在文件内添加了下面两句:
QMAKE_INCDIR = /usr/include/opencv
QMAKE_LIBS = -lcvaux -lcv -lcxcore -lhighgui -lml
实例程序,创建一个QT4 Console Application,代码如下:
复制代码
#include <cv.h>
#include <highgui.h>
int main()
{
IplImage *img = 0;
img = cvLoadImage("Lena.bmp",-1);//Lena.bmp在所建工程的目录下
cvNamedWindow("lena", 1);
cvShowImage("lena", img);
cvWaitKey(0);
return 0;
}
复制代码
关键的一步,在工程的.pro文件添加下面的内容:
复制代码
INCLUDEPATH += /usr/include/opencv
LIBS += /usr/lib/libcv.so \
/usr/lib/libcvaux.so \
/usr/lib/libcxcore.so \
/usr/lib/libhighgui.so \
/usr/lib/libml.so
复制代码
这时就能编译运行了。