How to specify an include path containing space using cHC08?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to specify an include path containing space using cHC08?

5,499 Views
admin
Specialist II
Hi,

I currently use the Codewarrior in command line i.e. cHC08 in a DOS prompt.

When I try to specify an include path which have space in it, I get this error:

"C:\Freescale\CodeWarrior HC08\prog\cHC08.exe" [...] -I"C:/Freescale/CodeWarrior HC08/lib/HC08c/include"
FATAL C50: Input file '-IC:/Freescale/CodeWarrior HC08/lib/HC08c/include' not found

Is there someone who know how to handle that?

Thank you very much,
Fred
Labels (1)
0 Kudos
5 Replies

721 Views
admin
Specialist II
I'm using cygwin and Eclipse on a XP machine.
And as you can see, I seem to use the double quote correctly.
Have you other suggestion?

Thanks again,
Fred


Message Edited by trifreddy on 2008-10-02 12:52 PM
0 Kudos

721 Views
CompilerGuru
NXP Employee
NXP Employee
This is exactly your problem....

You write the command line to cygwin as the chc08 compiler expects them,
but cygwin's shell moves the quotes. It has built in knowledge how the gnu tools are passing options with spaces and for those the conversion is fine. However chc08 does treat "-abc" as file because of the quotes.

With an intentionally wrong option "-wrongOption" and with -n to show the result in a dialog.
Using
>chc12.exe" -wrongOption -n -i"a space"   file.c

when calling from cmd.exe:

Code:
---------------------------chc12---------------------------Error during scanning of option "-wrongOption -n -i"a space"   file.c" from Command Line Options---------------------------OK  ---------------------------

 When doing the same from a cygwin bash:

Code:
---------------------------chc12---------------------------Error during scanning of option "-wrongOption -n "-ia space" file.c" from Command Line Options---------------------------OK   ---------------------------

 
Maybe someone else knowing Unix/cygwin better can help you how to pass the expected command with a cygwin shell.
Alternatives:
- don't use spaces
- use environment variables to pass the search paths
- call indirectly via cmd.exe, via windows command file
- figure out how to build the expected command line with bash (there must be a way, or?).


Daniel

BTW: The most problematic part of using gnu make on Win32 when I tried it in the past was the completely different behavior when sh.exe is in the path to when it is absent.

0 Kudos

721 Views
admin
Specialist II
How could I specify environement variable in the command line? This does not work:

-I{FREESCALE_PATH_WITH_SPACE}/lib/HC08c/include

Thanks,
Fred
0 Kudos

721 Views
CompilerGuru
NXP Employee
NXP Employee
There is an option -env to set environment variables for the compiler as argument, but that does not help you as the problem is how to pass options with quotes to the compiler. So using -env with environment variables with spaces has the same problem.
With environment variables I did mean the known variables by the compiler, e.g. GENPATH (or others, they are listed in the manual).
If you can set them in your scipt or makefile (by whatever means your shell allows you), then the compiler inherits those and uses them.
My guess for bash (I'm not into bash that much), something like

GENPATH=c:/path with spaces;c:/another path with spaces
LIBPATH=c:/path with spaces
OBJPATH=c:/path with spaces
export GENPATH
".../chc12.exe" "path to c file, maybe with spaces/file.c"

(just the rough idea, I'm sure it wont work just like that)

Daniel
0 Kudos

721 Views
CompilerGuru
NXP Employee
NXP Employee
Well, works for me.

The only way I'm aware to have files starting with a dash is to put the double quotes around the full name including the dash:
(This is NOT what you want, this tries to compile the file "-Ic:\s p a\include")
> piper.exe chc12.exe  "-Ic:\s p a\include"
However when I tried
> piper.exe chc12.exe  -I"c:\s p a\include"
the -I is taken as search path just as you expected it.
I wonder how you were starting the compiler, I used cmd.exe on a Vista machine, XP behaves the same I think.
However using a cygwin shell (bash/whatever) will pass the command line differently to the compiler, are you using cygwin?

The compiler has to be called with the double quotes after the -I. If the double quotes are placed by some tool before the -I, them it will compile it as file. If this is your issue, check how to resolve it with your launching tool.

Note than filenames with starting dashes are unusual but actually legal on Win32 (and on Linux).

Daniel
0 Kudos