日食 + CDT + Cygwin:如何解决“多个目标”问题?漏洞?

发布于 2024-10-03 03:32:21 字数 1633 浏览 0 评论 0原文

更新1: 我原来的帖子太长并且掩盖了真正的问题。我已经准确地发现了调用 Make 时导致“多个目标”错误的原因。

更新2: 我发现这个“多个目标”错误是由 GNU Make 版本 3.8.1 引起的(请参阅 此处 1此处 2 )。 GNU Make 3.8.1 是当前随 Cygwin 一起发布的 GNU Make。总结一下链接:旧的 v3.8.0 可以很好地处理 Windows 路径,而较新的 v3.8.1 会报告 Windows 路径的错误(也许这是来自 FSF 的被动攻击?)。


当您在 Eclipse+CDT+Cygwin 中启动一个没有外部包含/库的新项目时,一切对我来说都工作正常。

一旦我尝试使用外部包含/库,我就会遇到“多个目标”错误。

以下正是在 Windows+Eclipse+CDT+Cygwin 上重现该错误所需的步骤:

  1. 项目项目属性 --> C/C++ 构建 -->设置-->工具设置--> Cygwin C 编译器 -->包括-->包含路径 (-I) -->添加按钮-->选择目录--> “C:\dir1\dir2”
  2. 我点击了构建。
  3. 第一次构建时没有错误。
  4. 我再次点击构建...我收到构建错误“多个目标。停止。”。
  5. 我点击错误。

Eclipse 会调出一个 makefile。当 make 看到来自外部库的新包含文件的 Windows 路径时,就会发生错误:

# NOTE: Error happens when the first "C:/" occurs
src/main.d src/main.o: ../src/main.c C:/dir1/dir2/ExternalLibrary.h

Make 收到错误“多个目标”的原因是因为它看到“:”,它是用于声明目标的 Make 语法的一部分。当有两个“:”时,会出错,因为它不知道如何处理“多个目标”。


我无法手动编辑 makefile,因为它们会立即重新生成并覆盖[更新:由 Eclipse-CDT]。鉴于我无法手动编辑 makefile。

  1. 有没有办法让 Eclipse 不使用“C:\”路径?或者告诉 make 忽略“C:\”路径?
  2. 这是 Eclipse+CDT+Cygwin 的错误吗?
  3. 如果您使用 Eclipse+CDT+Cygwin...请借用一只手(我不想使用 Visual Studios...)!也许我使用Eclipse+CDT+cygwin错了?您如何让外部库包含工作?

*非常非常沮丧*

尝试保持开源和跨平台用户,

Trevor< /em>

UPDATE 1:
My original post was too long and obscured the real problem. I have discovered exactly what is causing the "Multiple targets" bug when Make is called.

UPDATE 2:
I found out that this 'Multiple Targets' bug is caused by GNU Make version 3.8.1 (see here1 and here2). GNU Make 3.8.1 is the current GNU Make released with Cygwin. To summarize the link: The old v3.8.0 handled windows paths fine and the newer v3.8.1 reports errors for windows paths (maybe it's a passive aggressive jab from the FSF?).


When you start a new project in Eclipse+CDT+Cygwin w/o external includes/libraries, everything works fine for me.

As soon as I try to use an external include/library I get the "Multiple targets" bug.

Here is exactly the steps needed to reproduce the bug on Windows+Eclipse+CDT+Cygwin:

  1. Project project properties --> C/C++ Build --> Settings --> Tool Settings --> Cygwin C Compiler --> Includes --> Include Paths (-I) -- > Add Button --> Pick directory --> "C:\dir1\dir2"
  2. I hit build.
  3. It builds with no errors the first time.
  4. I hit build again... I get build errors "Multiple targets. Stop.".
  5. I click on the error.

Eclipse pulls up a makefile. The error happens when make sees the windows path for the new include file from the external library:

# NOTE: Error happens when the first "C:/" occurs
src/main.d src/main.o: ../src/main.c C:/dir1/dir2/ExternalLibrary.h

The reason for Make getting an error "Multiple targets" is because it sees the ":" which is part of the Make syntax for declaring a target. When there are two ":", Make errors out because it doesn't know what to do with "Multiple targets."


I can not edit the makefiles manually because they are immediately regenerated and overwritten [UPDATE: by Eclipse-CDT]. Given that I can't manually edit the makefile.

  1. Is there any way for Eclipse to NOT use the "C:\" path? or tell make to ignore the "C:\" path?
  2. Is this an Eclipse+CDT+Cygwin bug?
  3. If you use Eclipse+CDT+Cygwin... please lend a hand (I don't want to use Visual Studios...)! Maybe I am using Eclipse+CDT+cygwin wrong? How do YOU get External Library includes to work?

*Very very frustrated*

Trying to stay Open-Source and cross-platform user,

Trevor

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

暗地喜欢 2024-10-10 03:32:21

事实证明,“多个目标”问题是由 Cygwin 安装的 GNU Make 的当前版本引起的。 GNU Make 3.8.1 是当前随 Cygwin 一起发布的 GNU Make。

GNU Make 3.8.1 不处理包含“C:\”的 Windows 路径。因此,每当您的 make 文件具有带有“C:\”的 Windows 路径时,您都会收到构建错误“多个目标”。

我最终做的解决方案是下载一个固定的 GNU Make v3.8.1。请参阅此处1这里2。然后 Eclipse+CDT+Cygwin 再次正常工作。

更新(05-feb-2015):
使用更新的 cygwin 和新的 Make (4.0.x),问题就消失了。
https://superuser.com/questions/154418/where-do-i-获取 cygwin 的 make

Turns out the "multiple targets" issue is caused by the current version of GNU Make installed from Cygwin. GNU Make 3.8.1 is the current GNU Make released with Cygwin.

The GNU Make 3.8.1 does not handle windows paths that contain "C:\". So every time your make file has a windows path with "C:\" you get a build error "multiple targets".

The solution I ended up doing is to download a fixed GNU Make v3.8.1. See Here1 or Here2. Then Eclipse+CDT+Cygwin worked fine again.

Update (05-feb-2015):
With an updated cygwin and a new Make (4.0.x) then the problem goes away.
https://superuser.com/questions/154418/where-do-i-get-make-for-cygwin

怪我闹别瞎闹 2024-10-10 03:32:21

也遇到过这样的问题。问题是我在项目设置中包含了路径。然后我就有了绝对路径。当在文件夹设置中包含相对路径的路径时,它工作得很好。

Had a such a problem, too. Problem was that I included paths on the project settings. Then I had absolute paths. When including the paths in the folder settings with relative paths it worked fine.

在你怀里撒娇 2024-10-10 03:32:21

后,我仍然遇到与 eclipse/CDT Juno 相同的问题

更新 cygwin修复它

:您需要 make 3.80-1 或更早版本,这需要 cygintl-2.dll。
从下载make3.80-1

http://www.filewatcher.com/m /make-3.80-1.tar.bz2.286814-0.html

以及所需的 Dll 来自

http://www.dllguru.com/cygintl-2.dll.html
将其提取到某处

将 cygwin/bin 中的 make 重命名为 makeVersion 例如 make3.82.90

复制 cygintl-2.dll 并制作成 cygwin/bin

尝试在 eclipse 中构建项目两次,问题应该消失

盖尔迪

I still Got the same problem with eclipse/CDT Juno after update cygwin

to fix it:

you need make 3.80-1 or older and this needs cygintl-2.dll.
download make3.80-1 from

http://www.filewatcher.com/m/make-3.80-1.tar.bz2.286814-0.html

and the needed Dll from

http://www.dllguru.com/cygintl-2.dll.html
extract it somewhere

rename your make in cygwin/bin to makeVersion e.g. make3.82.90

copy cygintl-2.dll and make into cygwin/bin

try build your project in eclipse twice, the problem should be disappeared

gerdi

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文