compiling and executing file problem

This is a discussion on compiling and executing file problem within the C Programming forums, part of the General Programming Boards category; hello, i am using visual studio 2010. i have been given two files by my teacher. he asked us to ...

  1. #1
    Registered User
    Join Date
    Dec 2010
    Posts
    29

    compiling and executing file problem

    hello,
    i am using visual studio 2010.
    i have been given two files by my teacher. he asked us to compile, execute and see what the result would be.
    i have to use cl -D_CRT_SECURE_NO_DEPRECATE *.cpp
    but then when i go the project via command window and execute the command it says:
    'cl' is not recognized as an internal or external command, operable program or file batch.
    if you want i will post both the files but any idea to what i could be doing wrong?

  2. #2
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Have you tried "cls" instead of "cl" ?

    That's the only console command for Windows that begins with "cl", and since the program obviously works with CRT commands, it fits right in.

  3. #3
    Registered User
    Join Date
    Dec 2010
    Posts
    29

    thank you

    i didn't get error message after changing cl to cls.

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    22,265
    I haven't had cause to use the command line when compiling with a Microsoft compiler in quite some time, but cl should be correct. cls should clear the screen instead.

    You should either use the command prompt from within Visual Studio, or add the directory containing cl to the system path.

    By the way, this is the C programming forum. You might ask a C++ specific question next, in which case it should go to that forum.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    Registered User
    Join Date
    Dec 2010
    Posts
    29
    By the way, this is the C programming forum. You might ask a C++ specific question next, in which case it should go to that forum.
    actually the files are written in c language but ya i get your point.
    if you could please tell me how to add the path i would appreciate it ( on the command prompt, i am already inside the directory containing both the necessary files).
    supposedly after the cl command is executed, an "exe" file should be generated.
    Last edited by ilikeapplepie; 04-03-2011 at 10:57 PM. Reason: additional details

  6. #6
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    22,265
    Quote Originally Posted by ilikeapplepie
    actually the files are written in c language
    Then change the file extension to .c

    Quote Originally Posted by ilikeapplepie
    if you could please tell me how to add the path i would appreciate it.
    Heheh, I cannot resist: instructions
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  7. #7
    Registered User
    Join Date
    Dec 2010
    Posts
    29

    thank you.

    thanks, laserlight.

  8. #8
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    22,265
    Quote Originally Posted by ilikeapplepie
    supposedly after the cl command is executed, an "exe" file should be generated.
    Yes, you will be compiling the source code to an executable program.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem compiling
    By Programmer_P in forum C++ Programming
    Replies: 4
    Last Post: 03-01-2010, 03:43 PM
  2. Switch/case problem with file I/O
    By C++beginer in forum C++ Programming
    Replies: 2
    Last Post: 05-23-2005, 03:56 PM
  3. Project compiling, but not executing correctly
    By sansuki in forum C++ Programming
    Replies: 1
    Last Post: 03-30-2005, 06:40 AM
  4. compiling and executing issue with lcc win32
    By GanglyLamb in forum C Programming
    Replies: 10
    Last Post: 12-22-2004, 02:24 PM
  5. resource file problem
    By jjj93421 in forum Game Programming
    Replies: 6
    Last Post: 03-30-2004, 10:58 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21