Click to See Complete Forum and Search --> : A few q's about c++


joelmon
10-20-2001, 02:47 AM
Hello, I am a hyper-newbie with c++. I mean like, I can't remember how to type it.

So, first of all, thanks for your time :)

Now, if I go and learn c++ (I want to learn more so I can be a better programmer and get more experience, long story) how do I test it?

Like with Active server pages, I can test it on personal web server or the linux I help run using chili asp

so, with c++. What do I physically use to create apps or scrips and test them?

Silly q, maybe, but I don't know what it does. How to test it. I just want to learn the embarassingly basic basics and I figured I'd ask. So, in short:

What does it do? Can I make a game? Make my website kick more butt? Use it on my pc win 98?

How do I create/edit/test what I do in c++? How do I get my hands dirty?

You guys, I can't thank you enough for your time. Sorry for such silly q's, but for me, they mean a LOT.

Thanks

Super Bakemono
10-20-2001, 04:35 AM
You just put the source in a text file and type 'g++ -oprogram program.cpp'

joelmon
10-20-2001, 04:40 AM
forgive my ignorance, using my windows 98
I open notpad

and then I enter the code

and then I type that, as the file n ame?

or do I use dos and execute it somehow? I bet that sounds stupid, I just *never* did this lol

thanks for the reply, i am sure after a few more dumb questions I'll be caught up ;)

EscapeCharacter
10-20-2001, 04:43 AM
well before i answer your questions, i would like to point out that if you havent programmed before(which is what it sounds like to me) you may want to start out with an easier language such as python or maybe perl.

that being said the very first thing anybody, IMO, should have is a good book, ill recommend the deitel & deitel C++ How to program, or Mercers' computing fundamentals with c++, both excellent books IMO. secondly you will have to be patient, learning to program is a pretty tough thing to get into. yes you can make games and whatnot, yes you can write cgi scripts in c++ to make your webpage better, though it might be simpler to write it in perl, but some people like to torture themselves :). you'll notice if you want to write a game that its not going to take you 1 day to bang out quake 3 which is millions of lines of code, and the stuff you will be starting out with will be no more than 300 lines most of the time. and yes you can program on a win98 pc.
my advice would be to learn an easier language first, i know it sounds boring but you will go no where if you dont understand basic program flow which every programming language has in it. learn the basic to the point where you write code knowing it will compile with no errors. thats pretty much all i can think of right now, im sure many others will add to what ive said.

[ 20 October 2001: Message edited by: EscapeCharacter ]

joelmon
10-20-2001, 04:55 AM
First of all, THANKS for a reply :)

Quick FYI, I know asp and am learning perl

I use linux server to execute perl and determine what I created is working I use linux/chiliasp/my pc to do the same for asp

what do I physically use to execute any file for c++? Like I open notepad, and type the code how do I know I created something? How does it come to life? Like the nt server does for asp and the linux does for perl

I bet I sound like a dork lol

I totally grasp the concept of 'small steps'
what I just want to know is how do I physically create what I am coding, to SEE it come to life. To compile. To make, to create

not just learn IT the language itself

kind of like perl. I don't want to learn perl know, imagine I didn't know I had to upload it to a unix server, for instance. If somebody says "You need a unix server" That is what I am looking for with c++

Then I noticed I can (As you stated) use my pc

what is the first step to do THAT? Not so much the language itslf, no tutorial shows this, just code

that's all

does this make sense? It's late, I babble

:)

Thanks for your time, VERY much appreciated

[ 20 October 2001: Message edited by: joelmon ]

EscapeCharacter
10-20-2001, 05:01 AM
well for an easy compiler you could get dev-c++ from http://www.bloodshed.net its a descent windows compiler and comes with i nice gui editor. i think though that you have confused c++(a compiled language) with perl(a scripted language) a compiled langauge is compiled into a binary that can then be executed, unlike perl scripts which you just edit save and run again. scripted languages are put through an interpreter everytime they are run, the interpreter translates the script language into machine code to be executed on the machine. compiled languages are compiled once into a binary and dont have to be recompiled everytime you run the program, see the difference?

joelmon
10-20-2001, 05:09 AM
I see. Thank you, by the way

I will consider that, certainly

Currently, I noticed borland has a c++ compiler

Yeah, to me, I am trying to visualize the process, way before I touch the code

to me, asp is a process of notepad, upload, debug.

Perl as well (Or a frontpage to save time)

So I am trying to grasp the steps such as 1 - x

1 is notepad
2 is (for example, only) save
3 is run it
...

that's my dilema, I am very eager to learn that before the code, so I don't stare at notepad all day lol

thanks, I'll get there just
need to take small steps, I presume. Can't get smaller than this :)

EscapeCharacter
10-20-2001, 05:13 AM
well in that case you

1. write the code
2. save it
3. compile it
4. if compile successfully run the program, if you got errors goto 1 and start again

joelmon
10-20-2001, 05:19 AM
yeah, it's late, I realize that logically I wouldn't have to start from scratch (I asked before I edited, if there are errors) (Oh, lord) but the logic is to COMPILE, I don't just save it like I would with asp/frontpage

that 3rd step before the end result makes this experience unique from perl/asp.

Would that be a good way to understand this process?

I'm trying ;) lol

thanks

[ 20 October 2001: Message edited by: joelmon ]

EscapeCharacter
10-20-2001, 05:24 AM
in step four if the source file compiles successfully, a binary is generated in windows its mostlikely filename.exe and the source file was filename.cpp. in perl the source file and the executable would be one in the same, filename.pl

joelmon
10-20-2001, 05:28 AM
OH, god, I downloaded the borland c++ for win 98, and it said not a valid win 32 file or what not, denied access

that's the 2nd file

I never receieved that for .exe files, and now that's the 2nd time

is that a sign of a virus?

Why would that happen? Or am I just overlooking something obvious? It might be off topic, but I ask only 'cause I never saw such a prompt and I was downloading a c+= compiler

actually, this is the 2nd I couldn't get to download without error/denied access

?

Just had to ask

thanks

joelmon
10-20-2001, 05:30 AM
Per your last reply, thanks

I will continue only per c++

I will try to redownload this compiler or try yours. I am so confused as to why it wasn't taken. Shall try again

In the meantime, t hanks for your help

Joel

PS. I ask about virus actually (Per last reply of mine) as it would shut off and tell me to close IE just like my last virus did)

EscapeCharacter
10-20-2001, 05:34 AM
well do you have a virus scanner

joelmon
10-20-2001, 05:40 AM
Yes. Nothing found

I downloaded it, I chose 'save to disk' or what not, not 'run from location' and after 8 mb were downloaded, I click on the .exe file and 0 b are found I noticed and that error is given when I try to execute it

and the download window shows *no* progress bar, just the amount downloaded, that's not normal. It's like a phantom download for the compiler

haha, of course lol

joelmon
10-20-2001, 05:56 AM
If I may, just curious

if I can't get these compilers to work
and I had to use notepad/dos

how would I use them in steps 1-4

notepad I open and type the code

what do I use as exension?

And when I am in dos, what command would I type if I do such a thing? If not, how would one use win 98? Just curious

thanks for your help

EscapeCharacter
10-20-2001, 06:03 AM
if you cant get the compilers to work then you are screwed, since there are no compilers included with windows

joelmon
10-20-2001, 06:47 AM
wonderful. lol

thanks. I hope I can get one of these things to download like the 100000 .exe files before them that have

when I do, I'll be back break records in newbie questions

;0

thanks

bwkaz
10-20-2001, 08:42 AM
You said it downloaded like 8MB and then you tried to run it ..... what I'm wondering is, did the download finish first?

Because of the way IE works when downloading, it puts the file in c:\windows\Temporary Internet Files\ first, then copies it to where you told it to download it to. So if it hasn't finished downloading, the file where you told it to save to will be 0 bytes long. It'll copy over it when it gets the whole thing.

Where are you downloading from? I could try it too, and see if it is just corrupted or something. I've got 98 on another partition here.

tnordloh
10-20-2001, 08:51 AM
ok, here's a rundown of the process a c++ program will do.
1. You type it in using notepad, or edit, or wordpad, and save it as a plain text document, and the filename would be something like program1.cpp. That extension is important to some compilers.

2. you run the compile command. If you manage to install djgpp, (located at http://www.delorie.com/djgpp/ )my favorite open-source windows compiler, the command would be g++ program1.cpp. At this point, the compiler takes over, reading your file in character-by-character, and parsing it out. It locates what it calls tokens, such as variable names, function names, plus signs, or whatever. Then it takes these and converts them into assembly language. Then the assembly language compiler takes over, and converts the resultant file into machine language, also known as binary code. This binary code is stored with the filename a.exe, on the win-type machines, and you can run it by typing a.exe while in that directory.

joelmon
10-20-2001, 04:53 PM
Wow, thanks guys. Starting to make more sense :)

To bwkaz >>

Ok, here's what's weird. The file literally completed download. And there was a warning about no access to that file afterwards. I thought that meant a virus

Usually, I download something (Zip works fine, the .exe was giving this error) there is a blue status bar that grows and shows progress. Not this. It was complete, and showed it had 0 b. Weird

the file I downloaded was the borland c++ compiler, the url is this:
ftp://ftpd.borland.com/download/bcppbuilder/freecommandLinetools.exe

I don't know why when I download it, the status bar doesn't show. It says it's copying x % of the file every few secs, but that's about it. Normal downloads on my ie 5.01 show the blue status bar growing as more data is transfered

So I will try the new compiler. It sucks I can't download an .exe after one year of no trouble

I executed it by clicking on it and it said not a valid win 32 file or what not. Odd

thanks,I hope I was clear

take care

paulb
10-20-2001, 05:51 PM
See if any of these work:

List (http://www.jacobschaos.com/inc/linkscompilers.html)

bwkaz
10-20-2001, 06:53 PM
Weird.... it worked for me after a while.

I had to manually FTP into the site, though. It was weird though, because I didn't have permission to list any of the directories except the root one. But since I knew the directories, I could change into them and get the file. It unzipped fine here, and I'll put it on the CS Web server here. The URL is http://www.csl.mtu.edu/~bwkadzba/freecommandLineTools.exe

Don't try to go to http://www.csl.mtu.edu/~bwkdazba though -- it's not set up right, you can just download the file from the other URL.

joelmon
10-20-2001, 07:22 PM
Ok, got the compiler to work

I created a hello world with it

but the ms dos window opens and THEN closes

how do I keep it open permenantly?

Just so it stays open til I tell it to quit?

Just curious :)

[ 21 October 2001: Message edited by: joelmon ]

bwkaz
10-21-2001, 09:01 AM
You can either add a getch(); line at the end of the program, so it'll stay open until you hit a key (and remember to #include <conio.h> if you do this), or you can right-click the .exe file that the compiler outputs, go into properties, and uncheck "close window on end" or whatever it's called.

bwkaz
10-21-2001, 09:05 AM
Or, I just thought of this. Go to Start, Run, and type command and hit Return. Then change directories to wherever your source files are, and when you want to run the program, just type program.exe (replacing "program" with whatever you named it, probably hello or something -- oh, and that shell isn't case sensitive). Then it'll keep the window open until you type exit to quit the shell.