Mail Archives: djgpp/1998/09/04/19:36:14
--------My Code---------------
#include <iostream.h>
main(void)
{
cout << "This is a test.";
}
------------------------------
> It will throw a wobbley if you don't define main() as int main()
The program has worked this way with all other C++ compilers - I was
taught that the return value of any function defaults to int if not
specified.
> (any function parameters not declared will be counted as void in C++,
I did specify the parameter as being void. --> main(void)
> Also note that at the end of the program you must have a return 0;
I understand this is normal programming practice, but omitting this
statement has produced comilable programs in the past with every other
compiler I have used.
> C++ standards state that you should output an endl at the end of each
> line you stream to the stdout.
Again, this was never required to compile programs with other compilers.
> gcc will not link with the C++ libraries according to extension. To do this
> you must use gxx (which will).
Well, if this is the case, then someone should notify the DJGPP people
that their info is misleading on the website. Here is an exerpt:
------------
Based on the file extension that you gave your program, it selects the
appropriate commands it needs to run to turn the source you gave it
into the output file you specified. ... Here is a list of file
extensions and what gcc does with them.
...
.cc .cxx .cpp .c++ .C (upper case)
C++ sources. These are preprocessed with cpp and then compiled with
cc1plus. You need gpp*b.zip.
...
-------------
-- Taken from
"http://www.delorie.com/djgpp/doc/ug/basics/compiling.html"
Thanks for your time and help.
--
-----------------------------------------
| ------------------------------------- |
| | Jason Saavedra - Student and Psycho | |
| | Sandia National Laboratories | |
| | Albuquerque, NM | |
| | ----------------------------------- | |
| | Any insanities expressed are mine. | |
| | (you may borrow, but please return) | |
| ------------------------------------- |
-----------------------------------------
- Raw text -