Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > a console application in C++

Reply
Thread Tools

a console application in C++

 
 
Puppet_Sock
Guest
Posts: n/a
 
      07-16-2007
On Jul 16, 4:03 am, arnuld <geek.arn...@gmail.com> wrote:
> i want to create a console application in C++ . what can be the 1st
> step ?


You need a compiler, linker, and the standard libraries.

You need some kind of ability to produce a source file.
That can be any convenient text editor that lets you
make a text file that your compiler can accept.

But this is off topic here. You need specifics on
how to run your local program, platform, compiler, etc.
If you have *language* questions, ask away. But how to
get your compiler etc. to produce an executable is off
topic here.

Look for help files or other docs with your compiler.
Look for news groups that have your compiler's name
in their name. Google for tutorials specific to your
particular compiler and platform.
Socks

 
Reply With Quote
 
 
 
 
Default User
Guest
Posts: n/a
 
      07-16-2007
Lionel B wrote:


> I used to use -ansi rather than -std=c++98 until it was pointed out
> to me (on this ng) that -std=c++98 is probably more appropriate; ISO
> is an international standardisation organisation, while ANSI is US
> only.
>
> Apart from which I've actually just had a look at the GCC manual and
> it doesn't say what -ansi does (if anything) for C++ - it only
> specifies the ISO 1990 C standard, apparently...


From the Solaris man pages:

-ansi
In C mode, support all ISO C90 programs. In C++ mode,
remove GNU extensions that conflict with ISO C++.



Brian

 
Reply With Quote
 
 
 
 
jjds101@yahoo.com
Guest
Posts: n/a
 
      07-16-2007
On Jul 16, 7:19 am, arnuld <geek.arn...@gmail.com> wrote:
> On Jul 16, 2:40 pm, Erik Wikström <Erik-wikst...@telia.com> wrote:
>
>
>
> > On 2007-07-16 10:03, arnuld wrote:

>
> > > i want to create a console application in C++ . what can be the 1st
> > > step ?

>
> > > NOTE: i did use Google but that gives me some VC++ based links using
> > > non-standard libraries.

>
> > What do you mean by console application? Roughly speaking there are two
> > kinds of applications, console and GUI and I don't think you've written
> > any GUI applications yet, which means that what you've done so far are
> > console applications.

>
> > If the input/output capabilities of cin/cout are not enough for your
> > needs you'll have to use some other, platform specific libraries since
> > there's nothing more advanced in standard C++. If this is what you want
> > ncurses might be worth looking into.

>
> sorry , i was at fault of not being clear. actually what we see at our
> colleges/universities is theoretical foundation like make a programme
> do this and do that. an average student from an average university
> (unlike MIT, CMU etc) reads books and does the things and when he
> enters in to the real-life software work like doing a job in industry
> or working directly with customers, he gets shock at first because it
> is *different*. same happened with me.
>


What the hell are you on about? This comes off like the rantings of a
madman

> i want to create some console programme, i mean, anything that can be
> called practical work and but which is general and approachable enough
> for a fresher like me..
>
> any ideas on that ?


Sure. The first is that you aren't going to get anywhere writing
vague and incomprehensible questions in a newsgroup. If you want to
write a program then write one. Do the exercises in a textbook.
Solve a problem. Or, if you're beyond more trivial matters and yearn
for something more like real-world experience, find an open source
project. There are plenty of places where open source apps can be
found. Start with a smaller one, and get familiar with the code --
add a feature, fix a bug, whatever.

 
Reply With Quote
 
arnuld
Guest
Posts: n/a
 
      07-16-2007
On Jul 16, 11:05 pm, jjds...@yahoo.com wrote:
> On Jul 16, 7:19 am, arnuld <geek.arn...@gmail.com> wrote:
>
>
>
> > On Jul 16, 2:40 pm, Erik Wikström <Erik-wikst...@telia.com> wrote:

>
> > > On 2007-07-16 10:03, arnuld wrote:

>
> > > > i want to create a console application in C++ . what can be the 1st
> > > > step ?

>
> > > > NOTE: i did use Google but that gives me some VC++ based links using
> > > > non-standard libraries.

>
> > > What do you mean by console application? Roughly speaking there are two
> > > kinds of applications, console and GUI and I don't think you've written
> > > any GUI applications yet, which means that what you've done so far are
> > > console applications.

>
> > > If the input/output capabilities of cin/cout are not enough for your
> > > needs you'll have to use some other, platform specific libraries since
> > > there's nothing more advanced in standard C++. If this is what you want
> > > ncurses might be worth looking into.

>
> > sorry , i was at fault of not being clear. actually what we see at our
> > colleges/universities is theoretical foundation like make a programme
> > do this and do that. an average student from an average university
> > (unlike MIT, CMU etc) reads books and does the things and when he
> > enters in to the real-life software work like doing a job in industry
> > or working directly with customers, he gets shock at first because it
> > is *different*. same happened with me.

>
> What the hell are you on about? This comes off like the rantings of a
> madman
>
> > i want to create some console programme, i mean, anything that can be
> > called practical work and but which is general and approachable enough
> > for a fresher like me..

>
> > any ideas on that ?

>
> Sure. The first is that you aren't going to get anywhere writing
> vague and incomprehensible questions in a newsgroup. If you want to
> write a program then write one. Do the exercises in a textbook.
> Solve a problem. Or, if you're beyond more trivial matters and yearn
> for something more like real-world experience, find an open source
> project. There are plenty of places where open source apps can be
> found. Start with a smaller one, and get familiar with the code --
> add a feature, fix a bug, whatever.


TROLL alert....

*PLONK*

 
Reply With Quote
 
Kai-Uwe Bux
Guest
Posts: n/a
 
      07-16-2007
arnuld wrote:

> i want to create a console application in C++ . what can be the 1st
> step ?


Find a problem that your program should solve. Without a problem, it is hard
to tell whether the program is correct/useful.

> NOTE: i did use Google but that gives me some VC++ based links using
> non-standard libraries.


Which libraries you will need is something to be determined once you know
what you want the program to do.


Best

Kai-Uwe Bux
 
Reply With Quote
 
Lionel B
Guest
Posts: n/a
 
      07-16-2007
On Mon, 16 Jul 2007 17:41:01 +0000, Default User wrote:

> Lionel B wrote:
>
>
>> I used to use -ansi rather than -std=c++98 until it was pointed out to
>> me (on this ng) that -std=c++98 is probably more appropriate; ISO is an
>> international standardisation organisation, while ANSI is US only.
>>
>> Apart from which I've actually just had a look at the GCC manual and it
>> doesn't say what -ansi does (if anything) for C++ - it only specifies
>> the ISO 1990 C standard, apparently...

>
> From the Solaris man pages:
>
> -ansi
> In C mode, support all ISO C90 programs. In C++ mode, remove
> GNU extensions that conflict with ISO C++.


Right, just found that. So it seems that for C++ -ansi *is* actually
equivalent to -std=c++98. Well... according to the docs, the g++ default
is -std=gnu++98' which is "the same as -std=c++98 plus GNU extensions".
So I guess if you remove those extensions you're left with -std=c++98. Or
am I missing some subtlety here?

Upshot is I think I'll stick with the more straightforward "specify the
actual standard you want" approach; i.e. -std=c++98

Oh, and I'm told you need -pedantic too for strict standards-
compliance... now *that* has without doubt the most confusing man entry I
have ever seen. Ever.

--
Lionel B
 
Reply With Quote
 
BobR
Guest
Posts: n/a
 
      07-16-2007

arnuld <> wrote in message...
On Jul 16, 11:05 pm, jjds...@yahoo.com wrote:
/* """
> > i want to create some console programme, i mean, anything that can be
> > called practical work and but which is general and approachable enough
> > for a fresher like me..
> > any ideas on that ?

>
> Sure. The first is that you aren't going to get anywhere writing
> vague and incomprehensible questions in a newsgroup. If you want to
> write a program then write one. Do the exercises in a textbook.
> Solve a problem. Or, if you're beyond more trivial matters and yearn
> for something more like real-world experience, find an open source
> project. There are plenty of places where open source apps can be
> found. Start with a smaller one, and get familiar with the code --
> add a feature, fix a bug, whatever.


TROLL alert....

*PLONK*
""" */

Troll?!?!? Look who's calling the kettle black!!

(hint: You've been given simple example(s), but, you keep asking the same
question. That's what 'Trolls' do!)

Show what *you* have done, and explain what problem you have with it.

Whether it's a 'console' or 'GUI' is the compilers function, not 'C++'.
I put 'console apps' in a 'class', and instantiate(run) them in wxWidgets (a
GUI), to try/test them. That has nothing to do with 'C++' (though it's coded
in 'C++'. <G>).

--
Bob R
POVrookie


 
Reply With Quote
 
arnuld
Guest
Posts: n/a
 
      07-17-2007
> On Jul 17, 4:25 am, "BobR" <removeBadB...@worldnet.att.net> wrote:
> arnuld <geek.arn...@gmail.com> wrote in message...


> TROLL alert....
>
> *PLONK*
> """ */
>
> Troll?!?!? Look who's calling the kettle black!!


BobR, a little search will tell you why i called "" a
troll. i am posting here from some time. did i call anyone a troll
till yet, except ""


???

> (hint: You've been given simple example(s), but, you keep asking the same
> question. That's what 'Trolls' do!)


ok , then call me a troll and *PLONK* me if you love to do so.

> Show what *you* have done, and explain what problem you have with it.
>
> Whether it's a 'console' or 'GUI' is the compilers function, not 'C++'.
> I put 'console apps' in a 'class', and instantiate(run) them in wxWidgets (a
> GUI), to try/test them. That has nothing to do with 'C++' (though it's coded
> in 'C++'. <G>).


well, thanks but i will not try GUIs, ATM, i will focus on creating
classes.

 
Reply With Quote
 
James Kanze
Guest
Posts: n/a
 
      07-17-2007
On Jul 16, 11:50 am, Lionel B <m...@privacy.net> wrote:
> On Mon, 16 Jul 2007 09:07:59 +0000, arnuld wrote:


[...]
> Note: the "-std=c++98 -pedantic" flags ensure that you are compiling
> according to the current C++ standard without any GCC-specific extensions/
> restrictions to the language.


Note that the "-std=c++98 -pedantic" flags only affect the
compiler, and do *not* ensure that you are not including
non-standard headers or linking against non-standard libraries.
Something like:

#include <unistd.h>

int
main()
{
static char const h[] = "Hello, world!\n" ;
read( 1, h, sizeof(h)-1 ) ;
return 0 ;
}

will compile and link, with those flags, on my system, but is
anything but standard C++. (It is standard Posix, however.)
On most (all?) Unix platforms, the C standard library and the
Posix standard library are merged in a way that makes it
impossible to separate them. (I'm not aware of an option for
VC++ which would make #include <windows.h> illegal either.)

With regards to the original question, concerning writing an
application in "standard" C++, the only real answer it to start
by documenting what is standard C++, and what isn't, and then
use a lot of personal discipline. Having two systems at your
disposition, one Windows and one Unix, and ensuring that all of
the code compiles and runs on both, helps a lot too. (But note
that both systems tend to have features to help migration from
the other, so it's not really a guarantee either.)

--
James Kanze (GABI Software) email:
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

 
Reply With Quote
 
James Kanze
Guest
Posts: n/a
 
      07-17-2007
On Jul 16, 1:20 pm, arnuld <geek.arn...@gmail.com> wrote:
> > On Jul 16, 2:50 pm, Lionel B <m...@privacy.net> wrote:
> > $ g++ -std=c++98 -pedantic hello.cpp -o hello
> > $ ./hello
> > Hello world


> > Note: the "-std=c++98 -pedantic" flags ensure that you are compiling
> > according to the current C++ standard without any GCC-specific extensions/
> > restrictions to the language.


> Lionel, i use this.


> g++ -ansi -pedantic -Wall -Wextra file.cpp


> tell me if it is ok ?


You probably want to add "-D_GLIBCXX_CONCEPT_CHECKS
-D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC", to catch illegal
use of the library.

--
James Kanze (GABI Software) email:
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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Starting a GUI application out of an console application Fabian Steiner Python 1 07-17-2006 05:01 PM
A simple Console Application to ASP.NET application Web learner ASP .Net 1 01-27-2006 03:09 AM
How to start ASP.Net application from console application? Mike ASP .Net 9 11-30-2005 12:26 AM
Re: console mp3->wav decoder for $indows or GUI one which supports console Egor Bolonev Python 0 06-30-2003 10:43 AM
Re: console mp3->wav decoder for $indows or GUI one which supports console Ben Finney Python 2 06-30-2003 05:43 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57