Thread: Compiling C program from command prompt (vs2015 developer command prompt) error

  1. #1
    Registered User
    Join Date
    Aug 2015
    Posts
    3

    Compiling C program from command prompt (vs2015 developer command prompt) error

    I'm following along here

    https://msdn.microsoft.com/en-us/lib...vs.140%29.aspx

    Using "Developer Command Prompt for VS2015"

    When I try to run "cl simple.c" I receive the "cl is not recognized as an internal or external command, operable program or batch file" error.

    I've attempted to troubleshoot myself and I'm guessing that "Developer Command Prompt" can't find compiler.exe.

    I've ran vsvars32 from the command prompt but I still receive the original error.

    How can I fix this or troubleshoot further?

    I am running all this as administrator.

    Compiling C program from command prompt (vs2015 developer command prompt) error-untitled-png

  2. #2
    Registered User rstanley's Avatar
    Join Date
    Jun 2014
    Location
    New York, NY
    Posts
    1,111
    When I try to run "cl simple.c" I receive the "cl is not recognized as an internal or external command, operable program or batch file" error.
    From the page you quoted here:

    If you get an error such as "'cl' is not recognized as an internal or external command, operable program or batch file," error C1034, or error LNK1104, you must set the environment for the compiler and tools. For details, review step 1.
    Please go back and re-read that page completely!

  3. #3
    Registered User
    Join Date
    Aug 2015
    Posts
    3
    I have, Stan. I have.

    https://msdn.microsoft.com/en-us/library/f2ccy3wt.aspx

    This too.

    Still not getting it.

  4. #4
    Registered User rstanley's Avatar
    Join Date
    Jun 2014
    Location
    New York, NY
    Posts
    1,111
    Still not getting it.
    Under "Prerequisites", in Section 1, it gives a petty clear solution.
    Open a developer command prompt. In Windows 8, on the Start screen, open the Visual Studio Tools folder and then choose the Developer Command Prompt shortcut. In earlier versions of Windows, choose the Start button, expand All Programs, Microsoft Visual Studio, and Visual Studio Tools, and then choose Developer Command Prompt.

    Depending on the version of Windows on the computer and the system security configuration, you might have to open the shortcut menu for Developer Command Prompt and then choose Run as Administrator to successfully build and run the application that you create by following these steps.
    The Developer Command Prompt automatically sets the correct path of the C compiler and any required libraries. Use it instead of the regular Command Prompt window. For more information, see Setting the Path and Environment Variables for Command-Line Builds.

  5. #5
    Registered User
    Join Date
    Aug 2015
    Posts
    3
    I sorta understand what the problem is but setting PATH hasn't been possible so far because I can't find where VS2015 is hiding compiler.exe. I uninstalled VS2015 and am using MinGW instead. No problem now. Linked /bin to Environment Variable with ease.

    Compiling C program from command prompt (vs2015 developer command prompt) error-untitled-jpg

    Thanks for the help. Sorry for trouble.

  6. #6
    Registered User
    Join Date
    Apr 2013
    Posts
    1,658
    In the case of Visual C / C++ express 2013, cl.exe, vcvars32.bat (also used for 64 bit mode), and the other programs are here:

    \Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin

  7. #7
    Registered User
    Join Date
    Mar 2013
    Posts
    63
    Please note I am not an experienced c/c++ coder but I have been using the attached batch files for c, c++, and c++(mfc) with VS 2015 community.
    I have versions for 2012-2015.
    These are a real hack but do appear to work.
    These are used from a normal command prompt
    VS15C.BAT
    VS15CPP.BAT
    VS15MFC.BAT
    parameters: filename(no extension) [-m32/-m64] [con gui dll obj lib] [debug release]
    Parameter #4 is optional. will default to release.

    James
    Attached Files Attached Files

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 11-07-2010, 08:54 PM
  2. Weird command prompt error, program not working..
    By Shamino in forum C++ Programming
    Replies: 18
    Last Post: 10-30-2007, 11:32 AM
  3. Replies: 2
    Last Post: 12-22-2006, 08:45 PM
  4. How do you run a program from the command prompt?
    By 7stud in forum C++ Programming
    Replies: 5
    Last Post: 08-20-2003, 08:46 PM
  5. Warnings when compiling with command prompt (MSVC++)
    By knave in forum C++ Programming
    Replies: 6
    Last Post: 08-06-2003, 01:31 PM