开发者

Eclipse + CDT + Cygwin: How do you fix the "Multiple targets" bug?

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 include开发者_如何学运维s/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


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


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜