更新时间:2023-11-17 23:30:52
存在此问题的错误:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=375800
一个工作和整洁的解决方法(信号请求者已经知道了这一点)。所以我只是交叉实际的答案:) https://bugs.eclipse .org / bugs / show_bug.cgi?id = 375800#c11
KrzysztofCzenńsk的所有学分
-MT $ {OUTPUT_PREFIX} $ {OUTPUT}
$ {COMMAND} $ {FLAGS} -MT $ {OUTPUT_PREFIX} $ {OUTPUT} $ {OUTPUT_FLAG} $ {OUTPUT_PREFIX} $ {OUTPUT} $ {INPUTS}
这将创建正确的.d文件
添加:解决方法有一个副作用。一个干净的使所有的
总是运行两次之前,它没有说什么。仍然好于不改编后编译; - )
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 ;-)