c++visual-studio-2010windows-7exe

/Fe (Name EXE File) is not working


I would like to compile a cpp source file in windows 7, visual studio 2010 using

Microsoft (R) C/C++ Optimizing Compiler Version 16.00.40219.01 for x64

When I do the following

>cl /EHs main.cpp -o test

I got

cl : Command line warning D9035 : option 'o' has been deprecated and will be removed in a future release

Ok fair enough. I've checked this page /Fe (Name EXE File). This option is not working with me.It gives me this error

cl : Command line warning D9024 : unrecognized source file type 'test', object file assumed
main.cpp
Microsoft (R) Incremental Linker Version 10.00.40219.01
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:main.exe
main.obj
test
LINK : fatal error LNK1181: cannot open input file 'test.obj' 

Now how should I activate this option? I always find it difficult to read MSDN Library. It is not friendly at all.


Solution

  • Note that there is no space between /Fe and the file name.

    cl /EHs /Fetest.exe main.cpp
    

    Alternatively, you can use the colon syntax:

    cl /EHs /Fe: test.exe main.cpp