473,399 Members | 2,278 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

How to get over this error?

Hi to all!
I have one big problem. I have written some code and I want to program
at the end looks good but theres one uninspected error.
What's going on?
I have written code for programm that needs to do input, output and
searching, for looking better i wanted to use simple DOS word cls
but(!!!!) in C/C++ there i cant use it. so I looked over the internet
and nearest i could find it's this code:

void gotoxy(int, int); // prototype
void clrscr(); // prototype
int main(){

// write text in 4 corners of the screen

clrscr(); // function call
gotoxy(10,10); // function call
cout << "at 10,10";
gotoxy(10,20); // function call
cout << "at 10,20";
gotoxy(20,10); // function call
cout << "at 20,10";
gotoxy(20,20); // function call
cout << "at 20,20";
return 0;
}
// function definition -- requires windows.h
void gotoxy(int x, int y){

HANDLE hConsoleOutput;
COORD dwCursorPosition;
cout.flush();
dwCursorPosition.X = x;
dwCursorPosition.Y = y;
hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(hConsoleOutput,dwCursorPo sition);
}
// function definition -- requires process.h
void clrscr(){
system("cls");
}

I have compiled it in Microsoft Visual Studio 6.0 and there i had
error, it said :
c:\program files\microsoft visual studio\vc98\include\eh.h(32) : fatal
error C1189: #error : "eh.h is only for C++!"

I looked for line where it is and that becomes that it's in standard
Microsoft Visual Studio 6.0 header file eh.h
line around the error are this:
#ifndef __cplusplus
#error "eh.h is only for C++!"
#endif
So my question is what i have to do to fix this error. I tried a lot of
combinations but I failed.

Thank You for help.

Mar 31 '06 #1
1 5180

ma*********@gmail.com wrote:
Hi to all!
I have one big problem. I have written some code and I want to program
at the end looks good but theres one uninspected error.
What's going on?
I have written code for programm that needs to do input, output and
searching, for looking better i wanted to use simple DOS word cls
but(!!!!) in C/C++ there i cant use it. so I looked over the internet
and nearest i could find it's this code:

void gotoxy(int, int); // prototype
void clrscr(); // prototype
int main(){

// write text in 4 corners of the screen

clrscr(); // function call
gotoxy(10,10); // function call
cout << "at 10,10";
gotoxy(10,20); // function call
cout << "at 10,20";
gotoxy(20,10); // function call
cout << "at 20,10";
gotoxy(20,20); // function call
cout << "at 20,20";
return 0;
}
// function definition -- requires windows.h
void gotoxy(int x, int y){

HANDLE hConsoleOutput;
COORD dwCursorPosition;
cout.flush();
dwCursorPosition.X = x;
dwCursorPosition.Y = y;
hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(hConsoleOutput,dwCursorPo sition);
}
// function definition -- requires process.h
void clrscr(){
system("cls");
}

I have compiled it in Microsoft Visual Studio 6.0 and there i had
error, it said :
c:\program files\microsoft visual studio\vc98\include\eh.h(32) : fatal
error C1189: #error : "eh.h is only for C++!"

I looked for line where it is and that becomes that it's in standard
Microsoft Visual Studio 6.0 header file eh.h
line around the error are this:
#ifndef __cplusplus
#error "eh.h is only for C++!"
#endif
So my question is what i have to do to fix this error. I tried a lot of
combinations but I failed.

Thank You for help.


The code is C++, not C, and so you've posted to the wrong newsgroup.
Even if cout were defined in C (it isn't unless you've done it
yourself), you couldn't bitshift it by a string. The definition of
gotoxy() could theoretically work in standard C with appropriate
headers and libraries, but based on the identifiers and the comment
before it I'd say it was a nonstandard Windows console routine, and
therefore offtopic. The #error directive in eh.h is actually trying to
help you by letting you know that the code only works in C++ (I suspect
that if you took the code to a different operating system and compiled
it as C++, if you had the same headers, you'd get a different #error
directive telling you that the code only worked under a Windows system,
or something to that effect). The definition of clrscr() is strictly
portable but will behave in an implementation-defined manner if called
(although it might quite possibly work on the system you use), and the
comment at the start is misleading because system() requires stdlib.h,
not process.h. // comments don't survive line-wrapping and aren't valid
in C89, so posting them to comp.lang.c is generally unwise.

At this point, many regulars would set followups to comp.lang.c++, but
I don't think you'll have any luck there either.

I don't know what a 'word cl' is but it's worth thinking about whether
you need one at all, as it reduces the portability of your code. As so
many people use C in all sorts of different contexts and different
systems, there are many newsgroups available. comp.lang.c is only for C
programs or sections of C programs which are portable across all C
systems; if there was just one newsgroup for all C questions, it would
be much harder to find the relevant questions/experts. It is also not
for C++, and AFAIK comp.lang.c++ is only for standard portable C++, so
you'll have to find a new program to work from or a different newsgroup.

Mar 31 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Brian | last post by:
We have an ASP program we are testing. So far only 1 machine gets this error. Any suggestions where to look, in order to debug this error? Thanks in advance for your help! ASP caught this...
12
by: craig | last post by:
Quick question for the experts... Whenever I set the Image property of a PictureBox on one of my windows forms to a PNG graphic file on my hard drive, I get the following runtime error when I...
3
by: ABC | last post by:
I use ASP.NET 1.1, no any ASP.NET 2.0 features to use. Just the page name is ProductMaster to display product master information. How can I fixed this error? Server Error in '/MAXXWeb'...
5
by: Andrew | last post by:
Hello, friends, In our development machine, the .net web app worked fine. Then we deployed it to our server. However, it did not work on the server. After a user entered user name/pswd and...
1
by: mar-kav | last post by:
Hello, i'm a beginner so exuse me: i installed IIS 5.1, Framework1.1, vs .NET 2003 i put my web dir' in inetpub/wwwroot, tried to broows to my homepage under localhost & got this error message: ...
2
by: mario.zoric | last post by:
Hi to all! I have one big problem. I have written some code and I want to program at the end looks good but theres one uninspected error. What's going on? I have written code for programm that...
5
by: maya | last post by:
hi, what is this error please? uncaught exception: Permission denied to call method Location.toString I see this error sometimes in FF error console but it says nothing about what causes...
2
by: prw8864 | last post by:
I can not see what is causing this error.... iterator has been defined properly, but the error seems to point to the interator type. Errors I get with g++ svector.c++ -o svector 2> ./err_txt...
2
by: Mark05 | last post by:
#include<conio.h> #include<iostream> using namespace std; int main() { double ManfCode,ProdCode; int Checkdigit, SecondManf, FourthManf; int FirstProd,ThirdProd,FifthProd; int...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.