tags:

views:

57

answers:

5

Hello All,

In building a C++ project with the GNU tool chain, make tells me ~

src/Adapter_FS5HyDE.d:1: * multiple target patterns. Stop.

Search, search, search, and I found out that make thinks that it has multiple targets because the path to my included headers has spaces in it. If you've got your headers stored in some sane place like C:\Program Files then you can take care of this by using the old DOS paths (e.g. C:\PROGRA~1). However, when you have your headers in a truly insane place like My Documents you can get around the problem with MY DOC~1 because there's still a space.

Any idea how to tell my compiler to look in My Documents for headers without make confusing the path as two objects?

(Note: Feel free to throw tomatoes at me for putting header files in My Documents if you'd like, but there is a little rationale for doing that which I don't feel like explaining. If the solution to this question is easy, I'd rather keep it the way it is.)

+1  A: 

I don't know about make specficially, but the normal way around this is to put quotes around the path i.e.

cd "C:\Program Files\"

does that work?

Colin Pickard
It doesn't in Makefile targets and dependencies.
reinierpost
+3  A: 

You can figure out what the old path is by doing a DIR /X in your command prompt.

Or, most of the time you can fake it with the first 6 characters - spaces + ~1 + extension (8.3 paths won't have spaces).

Or, you can use quotes: "C:\Documents and Settings\Administrator\My Documents".

Seth
A: 

Side note: the short name (8.3) for the same folder might not be the same on different OS installations. Thus, you can't be sure that C:\Program Files will always be C:\PROGRA~1.

  • Short names can't contain spaces in them either, so the usual short name for My Documents is MYDOCU~1, not MY DOC~1.
  • You can find the exact short name for any folder or file (including My Documents) using dir /x <filename>.
  • If you are using the GNU toolchain from Windows command line (cmd.exe), you should be able to use quotes (") around the folder/file names to work around this problem.
Franci Penov
A: 

For some folders, including My Documents, you can specify an alternative location. To do this, right-click the folder, select Properties, select Location tab, and away you go. I use this to put my downloads and music on another drive (D:).

Lachlan
A: 

Write a wrapper script (e.g. batchfile) to translate the path names to short form.

I have a script "runwin" that does stuff like this - instead of, e.g. gcc <args> I can call runwin gcc <args>; runwin will make heuristic guesses as to which arguments are filename paths and translate them, then call gcc on the resulting string of arguments.

reinierpost