Serving the Quantitative Finance Community

 
User avatar
JTB
Topic Author
Posts: 0
Joined: August 20th, 2010, 9:28 am

Compiling a Native C++ Program from the Command Line (C++)

October 24th, 2010, 7:35 pm

I am using Visual Studio 2008 and I have Windows 7.I am trying to learn C++, and I am trying to implement the simple example in the following link:http://msdn.microsoft.com/en-us/library ... spxFurther, I am opening the Visual Studio 2008 Command Prompt window (but not running it as an administrator).Opening the Visual Studio 2008 Command Prompt window i get the following:c:\Program files (x86)\Microsoft Visual Studio 9.0\VC>then I type: notepad simple.cppThen I get the error:' notepad' is not recognized as an internal or external command, operable program or batch fileWhat have I done wrong? I just following the example.But I know I that I have notepad; I have to open it manually.In general I am trying to run programs using the cl /EHscc:\Program files (x86)\Microsoft Visual Studio 9.0\VC>cl /EHsc simple.cppThen i get the following error message:Microsoft (R) 32-bit C/C++ Optimizing Compiler version 15.00.210022.08 for 80x86Copyright (C) Microsoft Corporation. All Right reserved.simple.cppc1xx : fatal error C1083: Cannot open source file: 'simple.cpp': No such file or directory
 
User avatar
ahew
Posts: 0
Joined: November 30th, 2002, 12:43 pm

Compiling a Native C++ Program from the Command Line (C++)

October 24th, 2010, 8:38 pm

Hi,You may need to add the full path of both notepad and your simple.cpp file, eg, something like: C:\WINDOWS\notepad.exe C:\simple.cppHope this helps
 
User avatar
JTB
Topic Author
Posts: 0
Joined: August 20th, 2010, 9:28 am

Compiling a Native C++ Program from the Command Line (C++)

October 25th, 2010, 6:42 am

I tried c:\windows\sytem32\dir simple.*So, the file exists there (in system 32).''But when I tryc:\windows\sytem32\ cl /EHsc simple.cpp I get the following error:c1xx:fatal error C10083: Cannot open source file: 'simple.cpp': No such file or directory.
Last edited by JTB on October 24th, 2010, 10:00 pm, edited 1 time in total.
 
User avatar
Hansi
Posts: 41
Joined: January 25th, 2010, 11:47 am

Compiling a Native C++ Program from the Command Line (C++)

October 25th, 2010, 8:48 am

QuoteOriginally posted by: JTBI tried c:\windows\sytem32\dir simple.*So, the file exists there (in system 32).''But when I tryc:\windows\sytem32\ cl /EHsc simple.cpp I get the following error:c1xx:fatal error C10083: Cannot open source file: 'simple.cpp': No such file or directory.Does simple.cpp reside in the directory you are currently in when running said command? Also why do you want to do command line compiling on Windows? Maybe a better idea would be to install MiniGW and do command line gcc compiling at least that's a more transferable skill which you might actually use at some point whereas I don't think you'll ever really need to compile via command line with Visual Studio.
Last edited by Hansi on October 24th, 2010, 10:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Posts: 23029
Joined: July 16th, 2004, 7:38 am

Compiling a Native C++ Program from the Command Line (C++)

October 25th, 2010, 10:15 am

QuoteI am trying to learn C++[...]This is hardly an effective way; why don't you use the Visual IDE? What you learn now is essentially makeSit back, relax and watch
Last edited by Cuchulainn on October 24th, 2010, 10:00 pm, edited 1 time in total.