問題描述
我有 Eclipse Platform 3.7.2 和 CDT 8.0.2.
當(dāng)我想做全部構(gòu)建"時,來自其他工作區(qū)項目的標頭不計為依賴項,并且不會重新構(gòu)建任何內(nèi)容.
我有一個 hello world 應(yīng)用程序和一個靜態(tài)庫項目.靜態(tài)庫在項目屬性 -> c/c++ 常規(guī) -> 路徑和符號 -> 引用選項卡 -> 選中活動"中設(shè)置為參考.這是我唯一更改的設(shè)置.
順便說一句,為什么 Eclipse 在項目屬性下有一個額外的項目引用"頂級項,這完全讓我感到驚訝.
無論如何,我嘗試了外部構(gòu)建器(在項目創(chuàng)建時默認選擇)和內(nèi)部構(gòu)建器,還結(jié)合了全局設(shè)置首選項 -> c++ -> 構(gòu)建 -> 僅在存在時構(gòu)建配置"Eclipse 資源變化......'
感謝您對此的任何想法.
更新:這是構(gòu)建依賴項目 Proj2 時的控制臺輸出(Proj1 是 lib).'make all' 被調(diào)用,但它只是重新鏈接,它不會重新編譯 Main.cpp.有熟悉 eclipse 生成的 makefile 的人嗎?再次感謝.
**** 為項目 Proj2 構(gòu)建配置調(diào)試 ****做所有構(gòu)建目標:Proj2調(diào)用:Cross G++ Linkerg++ -L"/home/user/.eclipse-workspace/Proj1/Debug" -o "Proj2" ./Main.o -lProj1完成的建筑目標:Proj2****構(gòu)建完成****
這已經(jīng)有 1.5 年的歷史了,想補充一下,已經(jīng)為此提交了一個 Eclipse 錯誤:https://bugs.eclipse.org/bugs/show_bug.cgi?id=375800
這個問題存在一個bug:https://bugs.eclipse.org/bugs/show_bug.cgi?id=375800
還有一個可行且簡潔的解決方法(原始請求者已經(jīng)知道這一點).所以我只是交叉鏈接到實際答案:) https://bugs.eclipse.org/bugs/show_bug.cgi?id=375800#c11
Krzysztof Czaińsk 的所有作品
在您的項目 c 或 c++ 編譯器設(shè)置中,在標志之后添加 -MT ${OUTPUT_PREFIX}${OUTPUT}
:
${COMMAND} ${FLAGS} -MT ${OUTPUT_PREFIX}${OUTPUT} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}
這將創(chuàng)建正確的 .d 文件
<小時>補充:解決方法有一個副作用.在一個干凈的 make all
之后總是運行兩次,然后才說什么都不做.仍然比更改后不編譯要好;-)
I have Eclipse Platform 3.7.2 and CDT 8.0.2.
When I want to do 'Build All' headers from other workspace projects are not counted as dependencies, and nothing is rebuilt.
I have a hello world application and a static library project. The static library is set as a reference in Project Properties -> c/c++ general -> Paths and SYmbols -> References tab -> checked 'Active'. That's the only setting I changed.
By the way, It totally beats me why Eclipse has an additional "Project References" top-level item under Project Properties.
Anyway, I tried both the External Builder (which gets selected by default on project creation) and the INternal Builder, also coupled with combinations of the global setting 'Preferences -> c++ -> Build -> Build configurations only when there are Eclipse resource changes........'
Thanks for any thoughts on this.
Update: This is the console output when building dependent project Proj2 (Proj1 is the lib). 'make all' is called but it merely re-links, it doesn't recompile Main.cpp as it should. Anyone out there familiar with eclipse-generated makefiles? Thanks again.
**** Build of configuration Debug for project Proj2 ****
make all
Building target: Proj2
Invoking: Cross G++ Linker
g++ -L"/home/user/.eclipse-workspace/Proj1/Debug" -o "Proj2" ./Main.o -lProj1
Finished building target: Proj2
**** Build Finished ****
Edit: This is 1.5 years old already, wanted to add that an Eclipse bug had been filed for this: https://bugs.eclipse.org/bugs/show_bug.cgi?id=375800
there exists a bug for this issue: https://bugs.eclipse.org/bugs/show_bug.cgi?id=375800
And a working and neat workaround (The orignal requester knows this already). So I just crosslink to the actual answer :) https://bugs.eclipse.org/bugs/show_bug.cgi?id=375800#c11
All credits to Krzysztof Czaińsk
In your project c or c++ compiler settings add -MT ${OUTPUT_PREFIX}${OUTPUT}
after the flags:
${COMMAND} ${FLAGS} -MT ${OUTPUT_PREFIX}${OUTPUT} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}
This will create the correct .d-files
Addition: The workaround has one side-effect. After a clean make all
always runs twice before it says nothing to do. Still better than not compiling after a change ;-)
這篇關(guān)于Eclipse CDT 沒有在頭文件更改時構(gòu)建項目的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!