| Re: run HelloWorld in Eclipse C++ [message #220109] |
Tue, 22 July 2008 20:38 |
Eclipse User |
|
|
|
Jonathan,
How far did you get with the MinGW installer? Is there a C:\Mingw
directory on your computer? If so you should not have to worry about
unpacking the mingw packages on your desktop. You can probably just
save those off somewhere or delete them. I just installed MinGW again
and the gdb debugger is not included like I thought it was so you'll
have to add that later but that shouldn't stop you from getting started
with the compiler.
To verify your mingw install (assuming there is a c:\mingw directory)
begin with start>run>"cmd.exe" and at the command prompt type cd \mingw
....> cd \mingw
and hit ENTER to move into the mingw directory. Now the prompt should
look like
C:\mingw>
Now use Notepad or your favorite alternative to create a file named
helloworld.c that contains the line
int main() { puts("hello world"); }
and save the file right there in the C:\mingw directory. Now go back to
the command window and type bin\gcc helloworld.c after the prompt so
it looks like
C:\mingw> bin\gcc helloworld.c
and press ENTER. You may get an error message about a missing newline
or you might just get the system prompt back right away. No worries,
type dir a.exe and hit ENTER
C:\mingw> dir a.exe
If you see a listing for a.exe - you have a working Mingw install.
a.exe is the compiled executable version of the helloworld.c program.
Try it.
C:\mingw> a
hello world
The biggest obstacle at this point is getting your PATH settings
adjusted so the compiler tools can be found by Eclipse and each other.
Right-click on your 'My Computer' icon and pick 'Properties' then choose
the Advanced tab and click the 'Environment Variables' button. Select
the PATH variable in the system variables box and click 'Edit'. Go to
the end of the variable value line and type ";C:\mingw\bin" without the
double quotes. Click OK's to get all the way out and you should be
ready to try building and running HelloWorld in Eclipse. Fire up
Eclipse and create the C++ HelloWorld project and you should find the
HelloWorld.exe file in the Binaries folder by the time you can find the
Binaries folder in the project.
-
Steve
Jonathan Katcher wrote:
> @Steve
> 1)"Winzip can handle tar files on Windows"
> great. :) I think i have winzip somewhere on my machine(don't know where
> to find it), In the past i've opened .zip files and folders without
> issues by right clicking and then selecting 'extract all'.
>
>
> 2)"The debugger gdb should be included in the gcc-core-3.4.5 package
> that the MinGW installer put on your desktop"
> great. :) Now what do I do to extract/unzip it?
>
>
> perhaps relevant is the following info.
> the path to the desktop:
> C:\Documents and Settings\user\Desktop
> the file name is:
> gcc-core-3.4.5-20060117-3.tar
>
>
>
> 3)"Can you compile HelloWorld from the command line without Eclipse?
> That's a pre-req for getting things to work with Eclipse."
> Uh oh. No. I must confess. I do not know very much at all about the
> command line.
> start>run>"cmd.exe"
> yeah. that bad.
>
>
>
> 7:24 PM 7/22/2008
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03514 seconds