導航:首頁 > 源碼編譯 > qtcreator源碼創建工程

qtcreator源碼創建工程

發布時間:2022-09-05 22:50:48

Ⅰ 怎麼樣編譯qtcreator源碼

找不到頭文件,既然頭文件還在,那就是路徑設置了,在工程屬性裡面找到包含文件路徑,將你需要的頭文件所在路徑添加進去就行

Ⅱ 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
復制代碼
這時就能編譯運行了。

閱讀全文

與qtcreator源碼創建工程相關的資料

熱點內容
卡爾曼濾波演算法書籍 瀏覽:768
安卓手機怎麼用愛思助手傳文件進蘋果手機上 瀏覽:843
安卓怎麼下載60秒生存 瀏覽:802
外向式文件夾 瀏覽:239
dospdf 瀏覽:430
怎麼修改騰訊雲伺服器ip 瀏覽:391
pdftoeps 瀏覽:495
為什麼鴻蒙那麼像安卓 瀏覽:735
安卓手機怎麼拍自媒體視頻 瀏覽:185
單片機各個中斷的初始化 瀏覽:723
python怎麼集合元素 瀏覽:480
python逐條解讀 瀏覽:832
基於單片機的濕度控制 瀏覽:498
ios如何使用安卓的帳號 瀏覽:882
程序員公園采訪 瀏覽:811
程序員實戰教程要多長時間 瀏覽:978
企業數據加密技巧 瀏覽:134
租雲伺服器開發 瀏覽:813
程序員告白媽媽不同意 瀏覽:335
攻城掠地怎麼查看伺服器 瀏覽:600