Discussion:
cl options
(too old to reply)
andrey the giant
2009-11-04 18:23:43 UTC
Permalink
A few questions about options to cl.exe:
1) Why is /o deprecated? What is its replacement?
2) Is there an option that skips generation of .obj and creates .exe
directly from [regex]\.c(pp)?[/regex] ?
Alex Blekhman
2009-11-05 07:51:27 UTC
Permalink
Post by andrey the giant
1) Why is /o deprecated? What is its replacement?
There is no /o compiler options in VC++ compiler at least since
VC6 (I cannot check earlier versions). What is the version of the
compiler you refer to?
Post by andrey the giant
2) Is there an option that skips generation of .obj and creates
.exe directly from [regex]\.c(pp)?[/regex] ?
AFAIK, no. Why is it a problem?

Alex
andrey the giant
2009-11-05 14:47:56 UTC
Permalink
Post by Alex Blekhman
Post by andrey the giant
1) Why is /o deprecated? What is its replacement?
There is no /o compiler options in VC++ compiler at least since
VC6 (I cannot check earlier versions). What is the version of the
compiler you refer to?
Really? Then how do you explicitly state the file name of the
resulting executable?
Post by Alex Blekhman
Post by andrey the giant
2) Is there an option that skips generation of .obj and creates
.exe directly from [regex]\.c(pp)?[/regex] ?
AFAIK, no. Why is it a problem?
Other compilers, such as gcc and icc, directly create the executable
from the source unless you run it in two stages:
$(CC) -c foo.c -o foo.o
$(CC) foo.o -o bar

When I run VC9, $(CC) foo.c -o bar.exe creates foo.o, when I didn't
ask for it.
Victor Bazarov
2009-11-05 15:59:23 UTC
Permalink
Post by andrey the giant
Post by Alex Blekhman
Post by andrey the giant
1) Why is /o deprecated? What is its replacement?
There is no /o compiler options in VC++ compiler at least since
VC6 (I cannot check earlier versions). What is the version of the
compiler you refer to?
Really? Then how do you explicitly state the file name of the
resulting executable?
Post by Alex Blekhman
Post by andrey the giant
2) Is there an option that skips generation of .obj and creates
.exe directly from [regex]\.c(pp)?[/regex] ?
AFAIK, no. Why is it a problem?
Other compilers, such as gcc and icc, directly create the executable
$(CC) -c foo.c -o foo.o
$(CC) foo.o -o bar
When I run VC9, $(CC) foo.c -o bar.exe creates foo.o, when I didn't
ask for it.
So, you're saying that it should blow away all temporary files it
creates in the process, except for the one you explicitly asked? Post a
suggestion the the VC++ bug database. I wouldn't hold my breath.

BTW, if you do it with G++, like

g++ foo.c -o bar

, does G++ create 'foo.o' as a intermediate result? If yes, does it
dispose of it afterwards? Or do you still see 'foo.o' lying around
after 'bar' is created?

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Tim Roberts
2009-11-06 06:30:12 UTC
Permalink
Post by andrey the giant
Other compilers, such as gcc and icc, directly create the executable
$(CC) -c foo.c -o foo.o
$(CC) foo.o -o bar
Actually, they don't. They run the two steps separately, then delete the
object file afterward.
Post by andrey the giant
When I run VC9, $(CC) foo.c -o bar.exe creates foo.o, when I didn't
ask for it.
Well, it creates foo.obj. Just embed an erase command in the makefile.
--
Tim Roberts, ***@probo.com
Providenza & Boekelheide, Inc.
andrey the giant
2009-11-05 14:54:25 UTC
Permalink
Post by Alex Blekhman
Post by andrey the giant
1) Why is /o deprecated? What is its replacement?
There is no /o compiler options in VC++ compiler at least since
VC6 (I cannot check earlier versions). What is the version of the
compiler you refer to?
Looking at the output of cl /?, /o maps to /Fe, /Fo, /Fp depending on
presence or absence of /c, /E

I'm guessing the deprecation warning says "/o is undocumented, use at
your own risk". Being a UNIX guy, I'm used to using -o to specify
output.
Alex Blekhman
2009-11-05 16:20:19 UTC
Permalink
Post by andrey the giant
Looking at the output of cl /?, /o maps to /Fe, /Fo, /Fp
depending on presence or absence of /c, /E
Also, you can use linker's /OUT switch to specify output file
name.
Post by andrey the giant
I'm guessing the deprecation warning says "/o is undocumented,
use at your own risk". Being a UNIX guy, I'm used to using -o to
specify output.
I think they keep this switch for compatibility with gcc. I
personally have never heard of it. It is completely undocumented.

Alex
Continue reading on narkive:
Loading...