Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Setting up a C++ compiler for Windows Command-Line
Index -> Programming, C++ -> C++ Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
apomb




PostPosted: Wed Nov 03, 2004 3:32 pm   Post subject: (No subject)

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.
Sponsor
Sponsor
Sponsor
sponsor
wtd




PostPosted: Wed Nov 03, 2004 3:49 pm   Post subject: (No subject)

Feel free to ask any questions you have in C/C++ Help and I'll be happy to answer them if I can.
apomb




PostPosted: Thu Nov 04, 2004 12:39 am   Post subject: (No subject)

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




PostPosted: Thu Nov 04, 2004 12:41 am   Post subject: (No subject)

CompWiz333 wrote:
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




PostPosted: Thu Nov 04, 2004 12:43 am   Post subject: (No subject)

i was going to post that with the other info, but im on "Me"... sadly
wtd




PostPosted: Thu Nov 04, 2004 12:48 am   Post subject: (No subject)

CompWiz333 wrote:
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




PostPosted: Thu Nov 04, 2004 12:56 am   Post subject: (No subject)

and this does ....
wtd




PostPosted: Thu Nov 04, 2004 1:00 am   Post subject: (No subject)

Once you've done that, open a command prompt and type

code:
C:\> g++


You should be greeted by something like:

code:
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:

code:
C:\> g++ my_program.cpp -o my_program.exe


And running it is:

code:
C:\> my_program


Of course you have to cd to the directory where your source file is, first.
Sponsor
Sponsor
Sponsor
sponsor
apomb




PostPosted: Thu Nov 04, 2004 1:09 am   Post subject: (No subject)

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




PostPosted: Thu Nov 04, 2004 1:11 am   Post subject: (No subject)

CompWiz333 wrote:
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




PostPosted: Thu Nov 04, 2004 1:13 am   Post subject: (No subject)

where do i type it, in an internet explorer console or DOS?
wtd




PostPosted: Thu Nov 04, 2004 1:14 am   Post subject: (No subject)

CompWiz333 wrote:
where do i type it, in an internet explorer console or DOS?


DOS.
apomb




PostPosted: Thu Nov 04, 2004 1:19 am   Post subject: (No subject)

alright, got that, now it has already
code:
C:\WINDOWS>
and then "bad command or file name"

ill try rebooting again ...
wtd




PostPosted: Thu Nov 04, 2004 1:22 am   Post subject: (No subject)

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




PostPosted: Thu Nov 04, 2004 1:31 am   Post subject: (No subject)

heres what is on screen right now:

code:
Bad command or file name
C:\WINDOWS>path
PATH=C:\WINDOWS\COMMAND\g++.exe


its there, now what? ...
Display posts from previous:   
   Index -> Programming, C++ -> C++ Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 18 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: