What type of project for a simple program to run in a DOS window

A

academic

I want to compile a simple c program.
Not c++ Not even Windows.

Just a simple program to run in a DOS window.

In vs2005 what type of project to I use.

I can't get started. I tried a couple of types but the wizard always
produces more then I need.

Thanks

What is the #include "stdafx.h" that keeps showing up for?
 
B

Bruno van Dooren

I want to compile a simple c program.
Not c++ Not even Windows.

Just a simple program to run in a DOS window.

In vs2005 what type of project to I use.

I can't get started. I tried a couple of types but the wizard always
produces more then I need.

Thanks

What is the #include "stdafx.h" that keeps showing up for?

with visual studio 2005, you can have to select a programming language in
either C#, VB.NET, C++ or J#.

if you got a file StdAfx.h, you selected a C++ project. StdAfx.h is the
default header file that will be compiled into a precompiled header for you.
the intention is that you put all the windows and library header in here if
they are needed in your project. they are compiled only once, instead of
each time you compile a cpp file. in your different cpp files you have to
include StdAfx.h.
this saves you a lot of compilation time.

StdAfx .cpp and .h are generated by default, and there is no harm in using
them.
you normally have console.cpp (or whatever your project name is) StdAxf.cpp,
StdAxf.h.
you can throw away the StdAfx files if you really want to.
in that case you also need to change the project properties to not use
precompiled headers

The simplest programs you can write are console applications. if you like
the C syntax you can choose between C# console applications and C++ console
applications.
with C# you always have to use .NET. with C++ you can choose to either use
the .NET framework or compile a native application.

--

Kind regards,
Bruno.
(e-mail address removed)
Remove only "_nos_pam"
 
A

academic

with C++ you can choose to either use the .NET framework or compile a
native application.
I don't see where I get this choice.
Testing I created (a few times) a C++ console project and never saw a chance
to pick one of these.


Thanks for replying
 
B

Bruno van Dooren

with C++ you can choose to either use the .NET framework or compile a
I don't see where I get this choice.
Testing I created (a few times) a C++ console project and never saw a
chance to pick one of these.

in VC2005, you select File->new->project. then:
under the Visual C++ option, you can select
win32 -> win32 console application: this option generates a project for a
native C++ console application.
or
CLR -> CLR console appliction: this option generates a project for a C++/CLI
console project that uses the .NET framework. CLR stands for Common Language
Runtime.
Thanks for replying
you're welcome.

--

Kind regards,
Bruno.
(e-mail address removed)
Remove only "_nos_pam"
 
D

David Wilkinson

academic said:
I don't see where I get this choice.
Testing I created (a few times) a C++ console project and never saw a chance
to pick one of these.


Thanks for replying

In VS2003, choose Win32 Console Project. On the final page of the
wizard, you will see "Application Settings" on the left; if you click it
you will see a bunch of check boxes and radio buttons. One of them
allows you to pick "Empty project". Now you will not have "stdafx.h",
and you can simply add .c files to the project.

HTH,

David Wilkinson
 
A

academic

Great, that clears it up.
thanks

Bruno van Dooren said:
in VC2005, you select File->new->project. then:
under the Visual C++ option, you can select
win32 -> win32 console application: this option generates a project for a
native C++ console application.
or
CLR -> CLR console appliction: this option generates a project for a
C++/CLI console project that uses the .NET framework. CLR stands for
Common Language Runtime.

you're welcome.

--

Kind regards,
Bruno.
(e-mail address removed)
Remove only "_nos_pam"
 

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

Top