久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

我可以在沒有 qmake 或 Qt Creator 的情況下使用 Qt

Can I use Qt without qmake or Qt Creator?(我可以在沒有 qmake 或 Qt Creator 的情況下使用 Qt 嗎?)
本文介紹了我可以在沒有 qmake 或 Qt Creator 的情況下使用 Qt 嗎?的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問題描述

我想使用 Qt 編程,但我不想使用特殊的編譯器或 IDE,例如 Qt Creator 和 qmake.我想和 Kate 一起寫,用 g++ 編譯.

I want to program using Qt, but I don't want to use special compilers or IDE such as Qt Creator and qmake. I want to write with Kate and compile with g++.

我可以用g++編譯一個(gè)使用Qt的程序嗎?我如何用 g++ 編譯它?

Can I compile a program that uses Qt with g++? How do I compile it with g++?

推薦答案

當(dāng)然可以.雖然用 qmake 或 CMake 更方便,但你可以這樣做:

Sure you can. Although it is more convenient with qmake or CMake, you can do:

CXXFLAGS += -Ipath_to_your_qt_includes
LDFLAGS += -Lpath_to_your_qt_libs

LDLIBS += -lqt-mt (for Qt3)

LDLIBS += -lQtCore -lQtGui (for Qt4, add what you need)

my_prog: my_prog.cpp

(在生成文件中)

更新 - 調(diào)用 moc:

引用自 moc 手冊(cè)頁(yè):

這是一個(gè)有用的 makefile 規(guī)則,如果您只使用 GNU make:

Here is a useful makefile rule if you only use GNU make:

m%.cpp: %.h
        moc $< -o $@

我個(gè)人將輸出命名為 %.moc.cpp(而不是 m%.cpp).然后將 my_prog 的依賴添加到 my_prog.moc.cpp

I'd personally name the output rather %.moc.cpp (than m%.cpp). You then add the dependency of my_prog on my_prog.moc.cpp

my_prog: my_prog.cpp my_prog.moc.cpp

同樣適用于 uic.這里的情況更復(fù)雜,因?yàn)槟惚仨殲轭^文件生成規(guī)則,并且你必須添加對(duì)頭文件的依賴以確保它在源代碼編譯之前生成.像這樣的事情可能會(huì)奏效:

Similarly for uic. The situation here is more complicated, since you have to generate rules for headers and source files, and you have to add a dependency on a header file to ensure it gets generated before the sources are compiled. Something like this might work:

my_prog: my_prog.o my_prog.moc.o my_prog.ui.o
        $(CXX)  $(LDFLAGS) -o my_prog $^ $(LDLIBS)

my_prog.o: my_prog.cpp my_prog.ui.h

這篇關(guān)于我可以在沒有 qmake 或 Qt Creator 的情況下使用 Qt 嗎?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

How can I read and manipulate CSV file data in C++?(如何在 C++ 中讀取和操作 CSV 文件數(shù)據(jù)?)
In C++ why can#39;t I write a for() loop like this: for( int i = 1, double i2 = 0; (在 C++ 中,為什么我不能像這樣編寫 for() 循環(huán): for( int i = 1, double i2 = 0;)
How does OpenMP handle nested loops?(OpenMP 如何處理嵌套循環(huán)?)
Reusing thread in loop c++(在循環(huán) C++ 中重用線程)
Precise thread sleep needed. Max 1ms error(需要精確的線程睡眠.最大 1ms 誤差)
Is there ever a need for a quot;do {...} while ( )quot; loop?(是否需要“do {...} while ()?環(huán)形?)
主站蜘蛛池模板: 精品亚洲国产成av人片传媒 | 欧美激情在线精品一区二区三区 | 亚洲精品成人网 | 日韩二区三区 | 国产精品国产a级 | 亚洲一区二区中文字幕 | 亚洲欧美精品久久 | 99久久婷婷 | 欧美一二三四成人免费视频 | 国产a级黄色录像 | 日本又色又爽又黄的大片 | 人人干人人艹 | 国产日韩欧美一区 | xxxxx黄色片| 色网站视频 | 黄色av大片 | 国产美女自拍视频 | 精品久久久久久久久久久 | 99tv| 成人在线小视频 | 国产精品二区三区在线观看 | 成人午夜精品 | 欧美激情亚洲天堂 | 国产精品揄拍一区二区久久国内亚洲精 | 五月激情综合网 | 日韩在线一区二区 | 亚洲视频免费在线观看 | 国产精品亚洲片在线播放 | 国产视频一区在线 | 日韩中文字幕av | 久久久久久久久一区 | 天天综合网天天综合色 | 国产成人精品视频在线观看 | 91视频免费在观看 | 在线a视频网站 | 91久久爽久久爽爽久久片 | 午夜在线观看免费 | 欧美一区2区三区4区公司二百 | 亚洲欧美日韩精品久久亚洲区 | 久久日韩粉嫩一区二区三区 | 亚洲一区二区三区在线免费观看 |