delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/09/11/15:23:14

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-0.4 required=5.0 tests=AWL,BAYES_00,URIBL_BLACK
X-Spam-Check-By: sourceware.org
Message-ID: <4AAAA396.7050901@bopp.net>
Date: Fri, 11 Sep 2009 14:23:02 -0500
From: Jeremy Bopp <jeremy AT bopp DOT net>
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: C++ script doesn't work using g++
References: <COL119-W278EB53D1BA885C2DC5810B0E70 AT phx DOT gbl>
In-Reply-To: <COL119-W278EB53D1BA885C2DC5810B0E70@phx.gbl>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Gery Herbozo Jimenez wrote:
> 
> I have a simple script:
> 
> #include 
> #include 
> int main()
> {
>         clrscr();
>         cout<<"Hallo";
>         getch();
> }

It looks like your include statements are missing what they are supposed
to include.  I made a guess that they should be as follows:

#include <iostream>
#include <conio.h>

> 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.
> 
> Any hint is grateful.

It's been a decade since I last used any significant C++, but it appears
that conio.h is missing.  Googling around tells me that conio is a
Borland extension, so it probably won't be available by default for g++.
 There appears to be a SourceForge project to provide an equivalent for
MinGW however:

http://conio.sourceforge.net/

This blog post looks like it might also be helpful:

http://www.technology-included.co.cc/2009/05/conioh-on-gcc-linux.html

The file it instructs you to download doesn't work for me with g++ under
Cygwin though.  It causes the compiler to report a bunch of errors.
Maybe you'll have better luck.

-Jeremy

--
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019