查看 Eclipse .cproject
和 .project
文件,我看到许多看似随机的数字:
<targetPlatform id="cdt.managedbuild.target.gnu.platform.mingw.exe.debug.928002373"
<tool id="cdt.managedbuild.tool.gnu.assembler.mingw.exe.debug.1473978281"
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1028037841"
<tool id="cdt.managedbuild.tool.gnu.archiver.mingw.base.917558104"
etc...
这些数字有什么用?
我正在编写生成文件的脚本,但我不确定是否需要为生成文件的每个项目更改这些数字 - 或者它们可以保持不变?
项目可能在同一个工作区中打开,所以我担心会发生某种冲突。
最佳答案
They really are just random numbers .
我将标识符的随机部分的添加追溯到 a commit in 2003 , 其中引用 Eclipse bug 44020 .
该错误涉及包含两个项目的工作区,其中项目的包含路径会混淆。提供的解释是:
The problem appears to have been caused by overlapping IDs in the build model. I have added code to make the IDs more unique and with a clean workspace, I can no longer get this behaviour to occur.
因此,某些设置似乎由某些标识符(例如构建配置的标识符)分组,并且这可能发生在给定工作区中的项目中——或者至少在 2003 年是这种情况。(代码很多太复杂了,我无法评估情况是否仍然如此。)
无论如何,为了安全起见,我会让生成的文件中的 ID 在工作区中的不同项目中保持唯一。
也就是说,关于编写脚本以生成 .cproject
文件这一更一般的主题,我建议阅读 this .
关于eclipse - Eclipse 项目文件中看似随机的数字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53297971/