Jump to content

C++ manual execution

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
12 replies to this topic

#1
jclarke

jclarke

    Programmer

  • Members
  • PipPipPipPip
  • 106 posts
I know that I have mentioned that I am learning C# Programming at the moment, but I am doing that for work anyway.

I was told from my teachers from Uni, that I will be learning C++ instead. So I am wondering while I am stuck with some sort of coding of this C++ World. Do you know how to execute C++ applications manually via the command prompt? Like for example where I execute .exe files for C# applications where it is show below

C:/<file location>>csc /nologo /out:<filename>.exe <filename>.cs

Is there any similarity like this for C++ .exe executions??

#2
Frenzy123

Frenzy123

    Newbie

  • Members
  • PipPip
  • 15 posts
Hi Jclarke from what i have learned i think that it depends on the program you are using to create your C++ projects. I have used Microsoft Visual Studios 5 and 6 packages and this creates an executable for you within the project folder which will run the program for you.

What program are you using to write your code?

I am not to sure but i should imagine if an executable isn't created automatically there will be an option with the program to do so. And then when you have the .exe file it is just a matter of typing the correct command in the cmd window.

Hope this helps, if anything i said is wrong please correct. :D

#3
jclarke

jclarke

    Programmer

  • Members
  • PipPipPipPip
  • 106 posts
I currently make the applications by Visual Studio 2005, but I would like to know if there is a 'manual' way to do it in the hard way to execute the application from the CMD window.

#4
Frenzy123

Frenzy123

    Newbie

  • Members
  • PipPip
  • 15 posts
Ahh in that case i think you are looking for this - Deployment (C++). Visual Studios has in-built deployment options. There are other ways to do this i think but may as well follow the guide mentioned on the page above.

Hope that helps

#5
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Yes, there are ways to manually compile C++ programs. You can also execute them from the command line. The details will vary depending on the compiler.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#6
jclarke

jclarke

    Programmer

  • Members
  • PipPipPipPip
  • 106 posts
I would have been expecting some sort of CMD code to execute the .cpp applications. But Visual Studio automatically executes them once it is completed in the software. But I'd like to see in a hard way, manually and outside VS 2005.

#7
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
I know there is a compiler that can be run outside the development environment. I haven't used it myself, however.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#8
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,720 posts
From what I've been reading, it appears that you're looking for a C/C++ interpreter. If that's what you want, you can try Ch 4.5.

#9
jclarke

jclarke

    Programmer

  • Members
  • PipPipPipPip
  • 106 posts

dargueta said:

From what I've been reading, it appears that you're looking for a C/C++ interpreter. If that's what you want, you can try Ch 4.5.

I am not sure what you mean, but it might be the one, you explained. But is that where it would execute the cpp.applications externally from the program through via the command prompt, is that correct?

#10
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,720 posts
Assuming that they haven't been compiled into an exe, then yes. For example, you'd have a file called myprog.cpp with your source code in it, and then you'd run it from the command prompt or a batch file like so:

ch myprog.cpp

(I think.) I'm not entirely sure, but it's probably something like that. It actually depends on the file names, but it's basically the same. Why are you looking for an interpreter anyway?

#11
v0id

v0id

    Retired

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,936 posts
dargueta: I don't think he's looking for an interpreter. I just think he wants to learn how to use a compiler manually, and not through an IDE (in this case, Visual Studio) where the whole compiling-process is done automatically.

jclarke: I'm not sure what the compiler Visual Studio is using is called. But I can give you an example on how to use the open-source compiler GCC for compiling a C++-source-file.
$ g++ ./filename.cpp -o ./filename
This will produce an executable file called; filename.

#12
jclarke

jclarke

    Programmer

  • Members
  • PipPipPipPip
  • 106 posts
vOid - I will give that code a try tomorrow at work and see what happens.

dargueta - What vOid just said is right, and to answer to your question. I am currently studying C++ at uni in part of my job, and I want to learn the most of it to acheive my grade into my certificate -- I enjoyed executing my C# files manually via the command prompt which it is the hard way to execute them but you always know that the Visual Studio automatically executes for you, but I would love to see in the hard way and manually for myself to see what is the difference and so I know how to if the Visual Studio crashes or doesnt work, you know what I mean?