
-----------------------------------
apomb
Wed Nov 03, 2004 3:32 pm


-----------------------------------
Well, im just trying to get a leg- up for next semester ... I am eventually going to learn it from school, but i have not had a good time figuring out C++ code.  I really want to learn it, but i can wait for instruction on that language.

-----------------------------------
wtd
Wed Nov 03, 2004 3:49 pm


-----------------------------------
Feel free to ask any questions you have in [url=http://www.compsci.ca/v2/viewforum.php?f=15]C/C++ Help and I'll be happy to answer them if I can.

-----------------------------------
apomb
Thu Nov 04, 2004 12:39 am


-----------------------------------
well, when i compile and run the simple "hello world" program, nothing happens (wil only run a bunch of words in the bottom of the "output" area, but no "hello world")

im on Dev C++... what am i missing

-----------------------------------
wtd
Thu Nov 04, 2004 12:41 am


-----------------------------------
well, when i compile and run the simple "hello world" program, nothing happens (wil only run a bunch of words in the bottom of the "output" area, but no "hello world")

im on Dev C++... what am i missing

The IDE is getting in the way.  You need a simpler setup.

Which OS are you running?

-----------------------------------
apomb
Thu Nov 04, 2004 12:43 am


-----------------------------------
i was going to post that with the other info, but im on "Me"... sadly

-----------------------------------
wtd
Thu Nov 04, 2004 12:48 am


-----------------------------------
i was going to post that with the other info, but im on "Me"... sadly

Do a search for "g++.exe" on your computer.  Find the directory that that program lives in.  Copy it.

This is from the Java setup page, slightly modified.

From the start menu, choose programs, accessories, system tools, and system information. This brings up a window titled "Microsoft Help and Support". From here, choose the tools menu, then select the system configuration utility. Click the environment tab, select PATH and press the edit button. Now add the location of g++.exe to your path as described in step b above. After you've added the location of g++.exe to your PATH, save the changes and reboot your machine when prompted.

-----------------------------------
apomb
Thu Nov 04, 2004 12:56 am


-----------------------------------
and this does ....

-----------------------------------
wtd
Thu Nov 04, 2004 1:00 am


-----------------------------------
Once you've done that, open a command prompt and type 

C:\> g++

You should be greeted by something like:

g++: no input files

If you are, then congrats, you have a working C++ compiler you can use from the command-line.

Compiling a source file then is as simple as:

C:\> g++ my_program.cpp -o my_program.exe

And running it is:

C:\> my_program

Of course you have to cd to the directory where your source file is, first.

-----------------------------------
apomb
Thu Nov 04, 2004 1:09 am


-----------------------------------
it says "page cannot be displayed"! dammit, and the path is correct too, hmm
hey, now theres a black screen, but it only flashes for like a nano second, then i closes

-----------------------------------
wtd
Thu Nov 04, 2004 1:11 am


-----------------------------------
it says "page cannot be displayed"! dammit, and the path is correct too, hmm

How far are you getting?  Where are you running into the problem?

-----------------------------------
apomb
Thu Nov 04, 2004 1:13 am


-----------------------------------
where do i type it, in an internet explorer console or DOS?

-----------------------------------
wtd
Thu Nov 04, 2004 1:14 am


-----------------------------------
where do i type it, in an internet explorer console or DOS?

DOS.

-----------------------------------
apomb
Thu Nov 04, 2004 1:19 am


-----------------------------------
alright, got that, now it has already 
C:\WINDOWS> and then "bad command or file name"

ill try rebooting again ...

-----------------------------------
wtd
Thu Nov 04, 2004 1:22 am


-----------------------------------
Not sure since I'm using 2000 Pro, but try typing "path" at the prompt and seeing if the string you see includes the path to g++.exe.

Note: you shouldn't include the "g++.exe" in that path.  Just the directory path.

-----------------------------------
apomb
Thu Nov 04, 2004 1:31 am


-----------------------------------
heres what is on screen right now:

 Bad command or file name
C:\WINDOWS>path
PATH=C:\WINDOWS\COMMAND\g++.exe


its there, now what? ...

-----------------------------------
wtd
Thu Nov 04, 2004 1:36 am


-----------------------------------
heres what is on screen right now:

 Bad command or file name
C:\WINDOWS>path
PATH=C:\WINDOWS\COMMAND\g++.exe


its there, now what? ...

Now, create a simple C++ program called hello.cpp.

#include 

int main()
{
   std::cout  hello

-----------------------------------
apomb
Thu Nov 04, 2004 2:41 am


-----------------------------------
oh man ... this is pissing me off, nothing is working, every time i push enter, it says "bad command or file name" and goes right back to 

 C:\WINDOWS>  

not just plain 

 C:\> 

WTF!

-----------------------------------
wtd
Thu Nov 04, 2004 3:43 am


-----------------------------------
oh man ... this is pissing me off, nothing is working, every time i push enter, it says "bad command or file name" and goes right back to 

 C:\WINDOWS>  

not just plain 

 C:\> 

WTF!

You're in the C:\Windows directory.  To change directories use:

C:\whatever> cd target_directory

If that directory is on a different drive...
C:\whatever> f:

To change to the F drive, as an example.
