Mail Archives: djgpp/1998/06/17/01:30:45
From: | sparhawk AT eunet DOT at (Gerhard Gruber)
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Question concerning gcc and C++
|
Date: | Tue, 16 Jun 1998 21:33:29 GMT
|
Organization: | Customer of EUnet Austria
|
Lines: | 53
|
Message-ID: | <3592e0a4.5385268@news.Austria.EU.net>
|
NNTP-Posting-Host: | e190.dynamic.vienna.at.eu.net
|
Mime-Version: | 1.0
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
I just tried compiling a small program from this newsgroup because the poster
said it doesn't work (the one with the password correct problem). When I
compiled it I noticed that there seems to be a difference between
"gcc -x c++ -o test.exe test.cc"
and
"g++ -o test.exe test.cc"
I thought that calling gcc with the language option should switch to the the
appropriate mode. But I get errors compiling this file and it appears as if
the compiler still doesn't switch correctly to C++ mode.
I get the follwing message:
In file included from d:/gnu/lang/cxx/libio.h:30,
from d:/gnu/lang/cxx/streambuf.h:36,
from d:/gnu/lang/cxx/iostream.h:31,
from test.c:2:
d:/gnu/lang/cxx/_G_config.h:20: parse error before `__extension__'
In file included from test.c:2:
d:/gnu/lang/cxx/iostream.h:91: parse error before `__extension__'
d:/gnu/lang/cxx/iostream.h:208: parse error before `__extension__'
The source is the same as I got it from the poster:
#include <conio.h>
#include <iostream.h>
#include <string.h>
int main()
{
clrscr();
char user_name[5] = "test";
char user_try[20];
cout << "Enter password: ";
cin >> user_try;
if (!strcmp(user_try, user_name))
cout << "Password Correct" << endl;
else
cout << "Wrong Password" << endl;
return 0;
}
--
Bye,
Gerhard
email: sparhawk AT eunet DOT at
g DOT gruber AT sis DOT co DOT at
Spelling corrections are appreciated.
- Raw text -