2

I'm currently working on an introductory C++ project, using Eclipse Juno, with CDT and Cygwin C++. I'm using an MVC architecture and have just gotten the code to a point where I can run the executable and see some results. When I build the application, the compiler doesn't throw any errors; however, when I run the application through Eclipse, the application rebuilds and displays the following error:

make: *** multiple target patterns.  Stop.  GasFinderTUI.d KyleGasStationFinder/Debug/src/View  line 1  C/C++ Problem

Here is my code from that file:

src/Controller/GasFinderController.d src/Controller/GasFinderController.o:  \
 ../src/Controller/GasFinderController.cpp \
  ../src/Controller/GasFinderController.h \
  C:/Users/Kyle/Dropbox/Workbench/KyleGasStationFinder/src/Model/LocalGasStations.h \
  C:/Users/Kyle/Dropbox/Workbench/KyleGasStationFinder/src/Model/GasStation.h \
  C:/Users/Kyle/Dropbox/Workbench/KyleGasStationFinder/src/Model/GasPump.h \
  C:/Users/Kyle/Dropbox/Workbench/KyleGasStationFinder/src/Model/Utilities.h

../src/Controller/GasFinderController.h:

C:/Users/Kyle/Dropbox/Workbench/KyleGasStationFinder/src/Model/LocalGasStations.h:

C:/Users/Kyle/Dropbox/Workbench/KyleGasStationFinder/src/Model/GasStation.h:

C:/Users/Kyle/Dropbox/Workbench/KyleGasStationFinder/src/Model/GasPump.h:

C:/Users/Kyle/Dropbox/Workbench/KyleGasStationFinder/src/Model/Utilities.h:

I've tried cleaning and rebuilding, without using the run function, and the application builds cleanly. I've also run the actual .exe file without Eclipse, and the application runs as expected. Although running the application separately from Eclipse is an acceptable substitute, I'll be writing several applications in C++ in the near future and would appreciate the ability to execute from Eclipse. These applications will also be examined and graded using Eclipse and I'm sure my instructor would also like this convenience.

I've looked at this question which recommends changing the C:/ for either a relative path name, or /cygwin/c/. My other .d files, as well as my include paths, utilize a relative path and those files pose no issue. Although I believe both of these solutions would work, the .d file is recreated for every compilation. All changes that I've made have been overwritten upon every build.

Does Eclipse and/or Cygwin C++ contain any settings that might allow me to prevent this complication from occurring in the future?

Community
  • 1
  • 1
floppsb
  • 696
  • 2
  • 9
  • 15
  • This question is actually about `Make` (or Eclipse) and not the compiler, so I've retitled it and retagged it to give it better exposure to those with the right knowledge. – Dietrich Epp Jan 25 '13 at 01:53
  • 2
    The problem is exactly that the `C:/` should be `/cygdrive/c/`. Make interprets the colon as defining a target pattern; when you have multiple colons on one line, you get a `multiple target patterns` error. You’ll probably have to write a wrapper script for whatever outputs the `.d` files, or a postprocessing step as part of the build system, that does an automatic search-and-replace turning `C:/` into `/cygdrive/c/`. – andrewdotn Jan 25 '13 at 06:33

2 Answers2

3

I've figured out that I can run the project inside Eclipse, only if I manually clean it before each run. Also, the builds are successful if I manually clean it before each build. I will look into creating a custom script for compilation after I submit this assignment.

floppsb
  • 696
  • 2
  • 9
  • 15
  • I believe I had to reset the builder from external to internal, or the other way around. I'm not sure how that actually got changed - probably when I was moving the project between computers. – floppsb Jul 16 '13 at 02:19
1

You can also remove the 'multiple target patterns' error when using the external 'Gnu Make' builder. I'm using Eclipse Kepler with CDT 8.3.0, and did the following:

  1. In Include path for all build configs, i.e. at Project Properties | C/C++ Build | Settings | Cygwin C [or C++] Compiler | Includes,
  2. Put 2 versions of each required include path, the Cygwin style followed by the Windows style, e.g.
    /cygdrive/d/cygwin64/usr/share/whatever/include
    D:/cygwin64/usr/share/whatever/include
  3. This causes the dependency files (*.d) in each build config's source directory to use the Cygwin-style paths in the dependencies, which removes the above error, as it is the colon ':' characters in these files which causes it, as @andrewdotn said.
  4. This also allows CDT to find the include files in the C/C++ source files, as it generally finds them when searching the Windows-style include path (Note: I'm using Cygwin as my build toolchain, rather than MinGW).

I realise the above is specific to a particular toolchain setting, but at least it gives a possible alternative way of getting the managed Make projects working properly.

This is my first post on StackOverflow, by the way, so if I make any etiquette mistakes, they're unintentional :)