473,474 Members | 1,857 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

error at compiling

Hello,

i have got a small problem while compiling my helloworld.c where i
include a driver class (comm.c). i compile under winXP with minGW and
have got this error:

--------------------------------------------------------------
D:\develop\spiderbot\testing>gcc hello.c
In file included from hello.c:4:
comm.c:45: parse error before "far"
comm.c:47: parse error before "far"
comm.c:47: warning: data definition has no type or storage class
comm.c:52: parse error before "far"
---------------------------------------------------------------

code snip (starting at line 45):
---------------------------------------------------------------
void (interrupt far *Serial)(); /* for origninal serial int. */

void interrupt far Handler(void);

/****************************************/
/* The actual serial interface driver */
/****************************************/
void interrupt far Handler(void)
----------------------------------------------------------------

can someone help me?

i have took out "#include <alloc.h>" at the beginning of comm.c because
this also made an error (couldent find taht file)...

thx for help!
martin petzold

Nov 14 '05 #1
9 2069
Martin Petzold <mp******@gmx.net> writes:
void (interrupt far *Serial)(); /* for origninal serial int. */


Neither `interrupt' nor `far' is a keyword in C. It looks like
you are trying to compile old, nonstandard MS-DOS code on another
platform. It would probably be easier to rewrite it from scratch
than to port it.
--
int main(void){char p[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv wxyz.\
\n",*q="kl BIcNBFr.NKEzjwCIxNJC";int i=sizeof p/2;char *strchr();int putchar(\
);while(*q){i+=strchr(p,*q++)-p;if(i>=(int)sizeof p)i-=sizeof p-1;putchar(p[i]\
);}return 0;}
Nov 14 '05 #2
Hi,

Ben Pfaff wrote:
Martin Petzold <mp******@gmx.net> writes:

void (interrupt far *Serial)(); /* for origninal serial int. */

Neither `interrupt' nor `far' is a keyword in C. It looks like
you are trying to compile old, nonstandard MS-DOS code on another
platform. It would probably be easier to rewrite it from scratch
than to port it.


thx! that was it...im not good at c jet. I have now got the win32 class
for this module an got this error:

D:\develop\spiderbot\testing>gcc hello.cpp
In file included from svlib.cpp:16,
from hello.cpp:2:
svlib.h:18: redefinition of `class SV200'
svlib.h:18: previous definition of `class SV200'

code
-------------------------------------------------------------------
#define SERVO1 1
#define SERVO2 2
#define SERVO3 3
#define SERVO4 4
#define SERVO5 5
#define SERVO6 6
#define SERVO7 7
#define SERVO8 8

#define NC -1

class CComm;

class SV200
{
protected:
CComm *comm;

char numStr[10];
int svSelect;
int savePosition[8];

void SerlXmitStr(char *str);

public:
SV200();
SV200(int comPort, int baudRate = 9600);
~SV200();
int Close(void);

void SvCmmd(char *cmmd, int param);
void SvCmmd2(char *cmmd, int param1, int param2);
void SelectBoard(int board);
void SelectServo(int servo);
void MoveSelect(int position);
void Move(int servo, int position);
void MoveAll(int S1, int S2, int S3, int S4, int S5, int S6, int
S7, int S8);
int GetNum(void);
unsigned char GetAD(int channel);
int AdjADJoystick(int position);

};
------------------------------------------------------------------

just would like to have it running once and then try (and learn) more...

thx martin

Nov 14 '05 #3
Martin Petzold wrote:
Hi,

Ben Pfaff wrote:
Martin Petzold <mp******@gmx.net> writes:

void (interrupt far *Serial)(); /* for origninal serial int. */


Neither `interrupt' nor `far' is a keyword in C. It looks like
you are trying to compile old, nonstandard MS-DOS code on another
platform. It would probably be easier to rewrite it from scratch
than to port it.

thx! that was it...im not good at c jet. I have now got the win32 class
for this module an got this error:

D:\develop\spiderbot\testing>gcc hello.cpp
In file included from svlib.cpp:16,
from hello.cpp:2:
svlib.h:18: redefinition of `class SV200'
svlib.h:18: previous definition of `class SV200'

code
-------------------------------------------------------------------
#define SERVO1 1
#define SERVO2 2
#define SERVO3 3
#define SERVO4 4
#define SERVO5 5
#define SERVO6 6
#define SERVO7 7
#define SERVO8 8

#define NC -1

class CComm;

class SV200
{
protected:
CComm *comm;

char numStr[10];
int svSelect;
int savePosition[8];

void SerlXmitStr(char *str);

public:
SV200();
SV200(int comPort, int baudRate = 9600);
~SV200();
int Close(void);

void SvCmmd(char *cmmd, int param);
void SvCmmd2(char *cmmd, int param1, int param2);
void SelectBoard(int board);
void SelectServo(int servo);
void MoveSelect(int position);
void Move(int servo, int position);
void MoveAll(int S1, int S2, int S3, int S4, int S5, int S6, int S7,
int S8);
int GetNum(void);
unsigned char GetAD(int channel);
int AdjADJoystick(int position);

};
------------------------------------------------------------------

just would like to have it running once and then try (and learn) more...

thx martin


okay! i found that on my own!
thx for all!

Nov 14 '05 #4
Martin Petzold wrote:

Hello,

i have got a small problem while compiling my helloworld.c where i
include a driver class (comm.c). i compile under winXP with minGW and
have got this error:

--------------------------------------------------------------
D:\develop\spiderbot\testing>gcc hello.c
In file included from hello.c:4:
comm.c:45: parse error before "far"
comm.c:47: parse error before "far"
comm.c:47: warning: data definition has no type or storage class
comm.c:52: parse error before "far"
---------------------------------------------------------------

code snip (starting at line 45):
---------------------------------------------------------------
void (interrupt far *Serial)(); /* for origninal serial int. */
[...]


`far' is not a keyword in the C language. In fact, it's
in the class of names specifically reserved for use as user-
defined identifiers: variable names, function names, struct
tags, and so on. So a C compiler reads this declaration in
exactly the same way it would read

void (interrupt widgets_per_wombat *Serial)();

.... and of course that makes no sense.

Compilers for some non-Standard C-ish variants use `far'
as a keyword to handle peculiarities of their underlying
platforms. If you need to use `far' in your code, you'll
need (1) to find such a non-C compiler and platform, and
(2) to seek advice from a newsgroup or other forum devoted
to that platform. In this case, it seems some kind of a
Microsoft newsgroup would be most helpful.

--
Er*********@sun.com
Nov 14 '05 #5
Martin Petzold <mp******@gmx.net> writes:
class CComm;


This is C++, not C.
Nov 14 '05 #6
Martin Petzold <mp******@gmx.net> writes:
[...]
D:\develop\spiderbot\testing>gcc hello.cpp
In file included from svlib.cpp:16,
from hello.cpp:2:
svlib.h:18: redefinition of `class SV200'
svlib.h:18: previous definition of `class SV200'

code [...] class CComm;

[...]

That's C++, not C, so we can't help you with it here. Try posting
your question in comp.lang.c++.

(When you do, make sure you post the complete program that you tried
to compile, preferably narrowed down to a small program that exhibits
the problem. The error message refers to files being included but
there's no "#include" in the source you posted.)

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://www.sdsc.edu/~kst>
Schroedinger does Shakespeare: "To be *and* not to be"
Nov 14 '05 #7
Martin Petzold wrote:
Hello,

i have got a small problem while compiling my helloworld.c where i
include a driver class (comm.c). i compile under winXP with minGW and
have got this error:

--------------------------------------------------------------
D:\develop\spiderbot\testing>gcc hello.c
In file included from hello.c:4:
comm.c:45: parse error before "far"
comm.c:47: parse error before "far"
comm.c:47: warning: data definition has no type or storage class
comm.c:52: parse error before "far"
---------------------------------------------------------------

code snip (starting at line 45):
---------------------------------------------------------------
void (interrupt far *Serial)(); /* for origninal serial int. */


Neither "interrupt" nor "far" have any meaning in C apart from what you
define them to be. Apparently you use some implementation where these are
given a meaning. It is a very poor idea to ask questions about
implementation-specific invasions of your namespace here. Surely there is
a newsgroup, mailing list, or tech supprt for your implementation where you
could ask.

--
Martin Ambuhl
Nov 14 '05 #8
Martin Petzold wrote:

Hello,

i have got a small problem while compiling my helloworld.c where i
include a driver class (comm.c). i compile under winXP with minGW and
have got this error:

--------------------------------------------------------------
D:\develop\spiderbot\testing>gcc hello.c
In file included from hello.c:4:
comm.c:45: parse error before "far" void (interrupt far *Serial)(); /* for origninal serial int. */

You are trying to use a nonstandard pointer declaration that was used on
some old MSDOS compilers. Get rid of all of them, the "far" declaration
is not necessary.

Brian Rodenborn
Nov 14 '05 #9
On Sat, 17 Jan 2004, Martin Petzold wrote:
Hello,

i have got a small problem while compiling my helloworld.c where i
include a driver class (comm.c). i compile under winXP with minGW and
have got this error:

--------------------------------------------------------------
D:\develop\spiderbot\testing>gcc hello.c
In file included from hello.c:4:
comm.c:45: parse error before "far"
comm.c:47: parse error before "far"
comm.c:47: warning: data definition has no type or storage class
comm.c:52: parse error before "far"
---------------------------------------------------------------

code snip (starting at line 45):
---------------------------------------------------------------
void (interrupt far *Serial)(); /* for origninal serial int. */

void interrupt far Handler(void);
Neither the word 'interrupt' or 'far' are part of the C standard. Some
compilers extend the list of keywords. If this is the case then this
source code will only compile on a specific compiler.

Another option is that there is a header with typedefs. You could try
scanning your headers for the content 'interrupt' and 'far'. #include the
appropriate header if you find it.

If all else fails try asking in a newsgroup specific to your operating
system or compiler.
/****************************************/
/* The actual serial interface driver */
/****************************************/
void interrupt far Handler(void)
----------------------------------------------------------------

can someone help me?

i have took out "#include <alloc.h>" at the beginning of comm.c because
this also made an error (couldent find taht file)...

thx for help!
martin petzold


--
Send e-mail to: darrell at cs dot toronto dot edu
Don't send e-mail to vi************@whitehouse.gov
Nov 14 '05 #10

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

Similar topics

0
by: Matt | last post by:
Just out of the blue all of my code has given a 'Could not instantiate the resource processor.' error on compiling. This apparently means your installation of VS .Net has lost the plot. So I've...
6
by: bmwrob | last post by:
I’m very new in C++ programming and am trying to make a decoder tool just for the purpose of learning. I started my project in VC++ 6.0, but after a change of PC, I continued my programming in VS...
2
by: Qiao Yun | last post by:
I used vc++.net (visual studio .net ) to open a project which can work well in vc++6.0. I succeeded in compiling the project in vc++.net in release mode . But when I tried to compile the project...
0
by: Herman Jones | last post by:
I'm getting the following error when I build a Class Library project: Embedding manifest... Project : error PRJ0002 : Error result 1 returned from 'C:\WINDOWS\system32\cmd.exe'. It happens with...
2
by: teddybyte | last post by:
my script below is: #include "stdafx.h" int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, ...
2
by: f rom | last post by:
----- Forwarded Message ---- From: Josiah Carlson <jcarlson@uci.edu> To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org Sent: Monday, December 4, 2006 10:03:28 PM Subject: Re: ...
1
by: sahilrekhi | last post by:
Hi i am working on a graphical user interface deisgn programme. when i compile the file i i get the following output with the mentioned errors: 1>------ Rebuild All started: Project: guiq,...
1
by: SQACPP | last post by:
I have an error when compiling a simple form project... I just start a new Form project and add a new PictureBox in a form(or anything that generate the .resx file) After that when compiling I...
0
by: dami.gupta | last post by:
I am building a chm file using sandcastle and am following instructions on https://blogs.msdn.com/sandcastle/archive/2006/07/29/682398.aspx I am following all the commands which are...
6
by: JR | last post by:
The code below compiles and runs perfectly in Windows XP Pro, Using MS VS 2005. If I compile with g++ (cygwin) using the following command line: g++ -pedantic -Weffc++ -Wall -Wctor-dtor-privacy ...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
1
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
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,...
1
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.