C++ Compiler for windows?

R

rufus

Is there a C++ compiler for windows that can be run from the commmandline? I
have only be able to find MS Visual Studio but its rather overkill since I
also like to just use notepad for my code.
 
L

Leclerc

rufus said:
Is there a C++ compiler for windows that can be run from the commmandline? I
have only be able to find MS Visual Studio but its rather overkill since I
also like to just use notepad for my code.

Well,
all of them can be run from command line.

For MS VC, you need to start "Visual Studio 20XX Command prompt" and
after that issue CL command. Alternative would be to start cmd.exe, and
after that execute vcvars32.bat, located in BIN directory of VC
distribution.
 
J

James Kanze

Is there a C++ compiler for windows that can be run from the commmandline? I
have only be able to find MS Visual Studio but its rather overkill since I
also like to just use notepad for my code.

VC++ works fine from the command line. As far as I know, in
fact, it can only be invoked from the command line---Visual
Studios generates a command line to invoke it.

If you've installed Visual C++ correctly, there should be an
entry in your program menus for "Visual Studio 2008 Command
Prompt", or something similar. This will start a console window
with the environment all set up. If you want to use a different
shell (highly recommended), then you'll have to copy the
necessary components of the path into your system path (or the
path of your shell), and define the environment variables LIB
and INCLUDE with the values they have in this window. (I've
used VC++ from the command line in MSys, CygWin and UWin; I
usually invoke it from a gmake file, however, which also works
fine under Windows. If you do use some of the Unix tool set,
however, you might want to consider moving things around so that
there are no spaces in any of the path names---you can make it
work with spaces, but it's a lot more difficult.)

The actual command is cl. Note that like most other compilers,
you'll need a lot of options for it to be really usable.
 
W

want.to.be.professer

VC++ works fine from the command line.  As far as I know, in
fact, it can only be invoked from the command line---Visual
Studios generates a command line to invoke it.

If you've installed Visual C++ correctly, there should be an
entry in your program menus for "Visual Studio 2008 Command
Prompt", or something similar.  This will start a console window
with the environment all set up.  If you want to use a different
shell (highly recommended), then you'll have to copy the
necessary components of the path into your system path (or the
path of your shell), and define the environment variables LIB
and INCLUDE with the values they have in this window.  (I've
used VC++ from the command line in MSys, CygWin and UWin; I
usually invoke it from a gmake file, however, which also works
fine under Windows.  If you do use some of the Unix tool set,
however, you might want to consider moving things around so that
there are no spaces in any of the path names---you can make it
work with spaces, but it's a lot more difficult.)

The actual command is cl.  Note that like most other compilers,
you'll need a lot of options for it to be really usable.

--
James Kanze (GABI Software)             email:[email protected]
Conseils en informatique orientée objet/
                   Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

Sure, cl is the compiler command , as well as rc and link.
On the other hand, you can download a Dev-C++,and put the bin
directory
to your system path,then you can use gcc, g++, etc.
 
R

rufus

"want.to.be.professer" <[email protected]> skrev i en meddelelse
VC++ works fine from the command line. As far as I know, in
fact, it can only be invoked from the command line---Visual
Studios generates a command line to invoke it.

If you've installed Visual C++ correctly, there should be an
entry in your program menus for "Visual Studio 2008 Command
Prompt", or something similar. This will start a console window
with the environment all set up. If you want to use a different
shell (highly recommended), then you'll have to copy the
necessary components of the path into your system path (or the
path of your shell), and define the environment variables LIB
and INCLUDE with the values they have in this window. (I've
used VC++ from the command line in MSys, CygWin and UWin; I
usually invoke it from a gmake file, however, which also works
fine under Windows. If you do use some of the Unix tool set,
however, you might want to consider moving things around so that
there are no spaces in any of the path names---you can make it
work with spaces, but it's a lot more difficult.)

The actual command is cl. Note that like most other compilers,
you'll need a lot of options for it to be really usable.

--
James Kanze (GABI Software) email:[email protected]
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

Sure, cl is the compiler command , as well as rc and link.
On the other hand, you can download a Dev-C++,and put the bin
directory
to your system path,then you can use gcc, g++, etc.

But will the executable compiled with a Dev-C++ gcc or g++ compiler be
executable on windows XP?
 
R

rufus

Leclerc said:
Well,
all of them can be run from command line.

For MS VC, you need to start "Visual Studio 20XX Command prompt" and after
that issue CL command. Alternative would be to start cmd.exe, and after
that execute vcvars32.bat, located in BIN directory of VC distribution.


Hm this works fine with cmd. But if I try the same with Windows PowerShell
nothing happens when I type "cl.exe", not even an error message.
 
J

Jerry Coffin

Is there a C++ compiler for windows that can be run from the commmandline? I
have only be able to find MS Visual Studio but its rather overkill since I
also like to just use notepad for my code.

You can still run the compiler with Visual Studio from the command line.
If you prefer something else, there are a few possibilities:

1) Microsoft Platform SDK (http://tinyurl.com/m3nld)
2) Borland (http://www.codegear.com/downloads/free/cppbuilder)
3) Digital mars (http://www.digitalmars.com/download/dmcpp.html)
4) MingW (http://www.mingw.org/node/19)
5) CygWin (http://www.cygwin.com/setup.exe)
6) ConceptGCC (http://www.generic-
programming.org/software/ConceptGCC/download.php)

If you're primarily interested in developing Windows applications and
happen to use C++, MS is probably the best choice -- but otherwise, it's
probably the furthest from conforming with the standard of those listed
here.

If you really wish you were doing your development under Linux, but
happen to be running Windows, CygWin is undoubtedly the best choice --
but otherwise, it's going to be a PITA because it's doing its best to be
BE Linux, despite running under Windows.

If you want to experiment with the latest and greatest language
features, ConceptGCC is almost certainly the best choice -- but
otherwise, it's stupidly slow, allows a lot of code that isn't (yet)
allowed by the standard.

I won't try to go through the strengths and weaknesses of every one, but
you get the general idea...
 
J

James Kanze

Sure, cl is the compiler command , as well as rc and link.

Never heard of rc, but cl is actually a compiler driver, like
g++ or CC (Sun), or most others. You don't actually invoke
link directly, you do it through cl.
On the other hand, you can download a Dev-C++,and put the bin
directory to your system path,then you can use gcc, g++, etc.

But why? The more or less standard compiler for Windows is
VC++. The only reason I can think of for using g++ under
Windows is portability: you want to use the same sources under
Windows as you did under Linux, without worrying about compiler
idiosyncracies. Whereas I (personally) try to get my code to
compile under as many different compilers as possible.
 
J

James Kanze

"want.to.be.professer" <[email protected]> skrev i en
meddelelseOn 7?13?, ??5?04?, James Kanze <[email protected]> wrote:
But will the executable compiled with a Dev-C++ gcc or g++
compiler be executable on windows XP?

I'm not sure what Dev-C++ is; I think it's an IDE, like Windows
Studio. But code compiled with g++ under MSys or CygWin on
Windows runs very well under all of the Windows I've tried it
on. (I haven't tried Vista yet, so I don't know. And I've not
tried with some of the older non-professional Windows, either,
before NT technology started being used on the personal systems
as well. But I can state from personal experience that there is
no problem with Windows NT, Windows 2000 or Windows XP.)
 
J

James Kanze

(e-mail address removed) says...

[...]
If you're primarily interested in developing Windows
applications and happen to use C++, MS is probably the best
choice -- but otherwise, it's probably the furthest from
conforming with the standard of those listed here.

Is that really true. The only other compiler on your list that
I've worked with is g++, and I'd rate recent versions of g++ and
VC++ fairly close; VC++ still has a few bugs with regards to
some of the more exotic uses of templates, but their library is
probably still slightly better than that of g++. But both are
to a point where you shouldn't notice the difference unless
you're writing very experimental code.

In the distant past: VC++ 6.0 was significantly more conform
than g++ 2.95.2, but there's no reason to use those versions
today.
If you really wish you were doing your development under
Linux, but happen to be running Windows, CygWin is undoubtedly
the best choice -- but otherwise, it's going to be a PITA
because it's doing its best to be BE Linux, despite running
under Windows.

Which is a PITA, even if you're a Unix freak, like I am. If I
want Linux, I know where to get it, and the cost isn't a
deterrant. There's such a thing as an emulation being too
exact; if I'm working under Windows, it's because I need simple
and direct access to the Windows features, and things like
making me type in /cygdrive/c/... rather than just c:/.. don't
help:). (The worst in this regard is MSys. If an argument
starts with a '/', and the executable isn't in the MSys
directory, it replaces the '/' with 'c:\msys\...'. Which means
that 'cl /help' provokes a very strange error message about not
being able to find the file 'c:\...\help'.)
 
J

Jerry Coffin

On Jul 13, 2:57 pm, Jerry Coffin <[email protected]> wrote:

[ ... ]
Is that really true. The only other compiler on your list that
I've worked with is g++, and I'd rate recent versions of g++ and
VC++ fairly close; VC++ still has a few bugs with regards to
some of the more exotic uses of templates, but their library is
probably still slightly better than that of g++.

Unfortunately, yes, it's really true. Not because Microsoft's compiler
is really that far behind everybody else, but because what they include
with the SDK is version 13.1, where Visual Studio currently comes with
version 15.x.

That's not so old that its conformance is truly terrible or anything
like that, but it's still old enough that I'm pretty sure most of the
others are closer.
 
G

Gennaro Prota

Jerry said:
On Jul 13, 2:57 pm, Jerry Coffin <[email protected]> wrote:

[ ... ]
Is that really true. The only other compiler on your list that
I've worked with is g++, and I'd rate recent versions of g++ and
VC++ fairly close; VC++ still has a few bugs with regards to
some of the more exotic uses of templates, but their library is
probably still slightly better than that of g++.

Unfortunately, yes, it's really true. Not because Microsoft's compiler
is really that far behind everybody else, but because what they include
with the SDK is version 13.1, where Visual Studio currently comes with
version 15.x.

That's not so old that its conformance is truly terrible or anything
like that, but it's still old enough that I'm pretty sure most of the
others are closer.

Pretty sure of something you haven't probably tried in a while.
Compilers evolve... VC++ was far behind the competition until a few
years ago but it has made very fast progresses starting with 7.1
(=.NET 2003, MSC_VER=1310). Have you really tried Digital Mars? Last
time I did --a couple of years ago-- it was _completely_ brain dead;
unusable for anything but toy examples. See e.g. this incredible bug:

<http://www.digitalmars.com/d/archives/c++/beta/596.html>
 
J

James Kanze

* James Kanze:

Not so funny when you actually have to deal with the problem.
James, have you considered very very exact Microsoft's Windows
Services for Unix (SFU, formerly Interix IIRC) -- it's free,
or at least, was, a few years ago.

This is the first I've heard of it, but I'll look into it. (I'd
also like to try the MKS toolkit; I used it many, many years
back, under MS-DOS, and found it very good. But they've priced
it way out of my budget today.)

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,244
Latest member
cryptotaxsoftware12

Latest Threads

Top