newbie! - sorry!

rurik leffanta plattermatic@earthlink.net
Sat Jan 31 18:32:00 GMT 2004


alex - thanks! sorry about that - since i've had to resort to using 1/2
dozen tutorials to figure out each simple step, i now had 6 different
conflicting sources of information..

..as such, following one alleged 'gcc' tutorial, i was successfully
compiling examples with a two stage operation:
gcc -c -o name.o name.c
gcc -mwindows -o name.exe name.o

so i guess i was attempting to compile it as a c program as opposed to c++??
:p dumb error, i blame the tutorial :)

i've found i can compile c++ using two different commands:

gcc name.cpp
or:
c++ name.cpp

(or, now add alex's g++..)

which is great, except i have no information about what the difference is,
or any clue why they both work when i only have one v. of gcc, beyond i have
tutorials that say to do it each way.. curious indeed.

i want to write my *first* program to simply create a text file and put a
word in it.

can i *find* a demo program that addresses just this fundamental, elementary
function? NO! :p

instead i've got 32 'hello world' programs, each of which are different :)

#include <fstream>
ofstream out;
out.open("testfile.txt");
out << "here is a line" << endl;
out.close();

look. i'm totally screwing around in the dark here. i've tried wrapping it
all in a 'main' function, leaving parts inside and outside, i'm aware that
there is no 'nice, safe,' code for checking to see whether the file exists.

could somebody turn this into a nice example of how to make a program that
creates a text file, and one day, i'll put it all on the web in a nice
tutorial about how to use (install..) gcc coming from basic, in english..

i hate asking for help :p :)
--
http://home.earthlink.net/~plattermatic
http://www.panicnow.net/~xoxos
----- Original Message -----
From: "rurik leffanta" <plattermatic@earthlink.net>
To: <gcc-help@gcc.gnu.org>
Sent: Saturday, January 31, 2004 10:22 AM
Subject: newbie!


> i'm attempting to write my vewy first c++ prog....
>
> in order to perform iostream operations, i have to #include <iostream>
>
> yes? yes. :p (or iostream.h, depending on tutorial..)
>
> however, 'iostream' is not at the top of my include folder. i am using
mingw
> 3.1.0-1 (and have successfully compiled example scripts) - the path for
> iostream with this install is include/c++/3.2.3
>
> i've tried adding the path to the include statement, putting .h at the end
> of iostream..
>
> sheesh! should i copy everything from the subfolders and put it in the
main
> folder? what do i have to do here?
> --
> http://home.earthlink.net/~plattermatic
> http://www.panicnow.net/~xoxos
>



More information about the Gcc-help mailing list