Mail Archives: djgpp/1997/07/24/14:18:40
Isaac Waldron wrote:
>
> try using code like this:
>
> #include <iostream.h>
>
> void main()
> {
> cout << "Hello World.";
> }
>
> Also, since iostream.h is a C++ only file, make sure your filename has a
> cpp extension.
If you're going to post examples, try to make them adhere to standard
programming conventions. main() must always return an integer. Also,
gcc can recognize C++ programs with the extensions .C (capital c), .cc,
and .cpp. And you're omitting the most important part, linking the C++
library.
To correctly compile the above program, you must use one of these two
command lines:
gcc -o hello.exe hello.cpp -lgpp
gxx -o hello.exe hello.cpp
'gxx' takes care of linking the C++ libraries for you. If you use
RHIDE, you don't need to worry about this as long as you give your
source file a correct name.
If you have further problems, please consult the 'readme.1st' file
and/or the DJGPP Frequently Asked Questions list (v2/faq210b.zip from
SimTel or online at http://www.delorie.com/djgpp/v2faq/). You won't be
disappointed.
--
John M. Aldrich <fighteer AT cs DOT com>
* Anything that happens, happens.
* Anything that, in happening, causes something else to happen,
causes something else to happen.
* Anything that, in happening, causes itself to happen again, happens
again.
* It doesn't necessarily do it in chronological order, though.
--- Douglas Adams
- Raw text -