This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: C++ script doesn't work using g++



Thanks for your answer Larry. I'll try in the same way you did. It's a pity cygwin doesn't support borland c++.
 
Cheers,
 
Gery



----------------------------------------
> Date: Fri, 11 Sep 2009 15:57:22 -0400
> From: reply-to-list-only-lh@cygwin.com
> To: gamejihou@hotmail.com
> Subject: Re: C++ script doesn't work using g++
>
> On 09/11/2009 02:49 PM, Gery Herbozo Jimenez wrote
>> I have a simple script:
>>
>> #include
>> #include
>> int main()
>> {
>> clrscr();
>> cout<<"Hallo";
>> getch();
>> }
>>
>> However it doesn't work under this command:
>>
>> g++ hallo.cpp -o hallo.exe
>>
>> It gives:
>>
>> In file included from /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/backward/iostream.h:31,
>> from hallo.cpp:1:
>> /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please
>> consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the header for the header for C++ includes, or
>> instead of the deprecated header . To disable this warning use -Wno-deprecated.
>> hallo.cpp:2:19: conio.h: No such file or directory
>> hallo.cpp: In function `int main()':
>> hallo.cpp:6: error: `clrscr' undeclared (first use this function)
>> hallo.cpp:6: error: (Each undeclared identifier is reported only once for each function it appears in.)
>> hallo.cpp:8: error: `getch' undeclared (first use this function)
>>
>> Someone knows why? I tested it under borland c++ (v.5) in windows and
>> works perfectly.
>
> That's because it's written to use Borland C++-specific facilities (i.e.
> it's not
> portable). Although there are a number of ways to address this, here's what
> I did:
>
> #include 
> #include 
>
> using namespace std;
>
> int main()
> {
> initscr();
> clear();
> refresh();
>
> cout<<"Hallo";
> cout<> getch();
> endwin();
> }
>
> g++ hallo.cpp -o hallo.exe -lcurses
>
> Of course, to make this work you'll need to install the ncurses-devel package.
>
> --
> Larry Hall http://www.rfk.com
> RFK Partners, Inc. (508) 893-9779 - RFK Office
> 216 Dalton Rd. (508) 893-9889 - FAX
> Holliston, MA 01746
>
> _____________________________________________________________________
>
> A: Yes.
>> Q: Are you sure?
>>> A: Because it reverses the logical flow of conversation.
>>>> Q: Why is top posting annoying in email?
_________________________________________________________________
Hay tantos ordenadores como personas. ¡Descubre ahora cuál eres tú!
http://www.quepceres.com/

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]