|
-
June 16th, 2006, 08:46 AM
#1
How to read this, it seems like it has two types
Here is the part thats causing the error
#ifndef YY_SKIP_mbs_yysbuf
#ifdef __cplusplus
extern "C" int mbs_yysbuf YY_PROTO(( void ));
#else
extern int mbs_yysbuf YY_PROTO(( void ));
#endif
#endif
Particularly, iam having trouble with
extern int mbs_yysbuf YY_PROTO(( void ));
I am not sure how do define mbs_yysbuf in my heaer file. If i do not define, there will be an error saying
legacy error LNK2019: unresolved external symbol _mbs_yysbuf referenced in function _yylex
Is int the type of YY_PROTO(( void )) or is mbs_yysbuf the type of YY_PROTO(( void ))??
i believe the resolution is to define mbs_yysbuf in the header file, but i am not sure how to define it.
Last edited by linhung; June 16th, 2006 at 09:07 AM.
-
June 16th, 2006, 08:51 AM
#2
Re: How to read this, it seems like it has two types
How did you come up with this problem? That is, why do you compile this code out of context?
"Programs must be written for people to read, and only incidentally for machines to execute."
-
June 16th, 2006, 08:53 AM
#3
Re: How to read this, it seems like it has two types
Hi,
This is part of the grogram. The compiler indicates this part is causing the error, so I pasted it on here seeking for help.
-
June 16th, 2006, 09:16 AM
#4
Re: How to read this, it seems like it has two types
Brilliant.
add to get rid of it.
"Programs must be written for people to read, and only incidentally for machines to execute."
-
June 16th, 2006, 09:31 AM
#5
Re: How to read this, it seems like it has two types
 Originally Posted by RoboTact
Brilliant.
add to get rid of it.
Shouldnt I use #define mbs_yysbuf something, what should I put for something??
-
June 16th, 2006, 09:41 AM
#6
Re: How to read this, it seems like it has two types
The define you want is:
Code:
#define YY_PROTO (proto) proto
This is a workround for old C compilers that did not allow you to declare the types of arguments to functions. There was actually never any need for it after #ifdef __cplusplus, but the author of your header file probably cut and pasted a definition.
Hope that helps.
-
June 16th, 2006, 09:41 AM
#7
Re: How to read this, it seems like it has two types
 Originally Posted by linhung
Shouldnt I use #define mbs_yysbuf something, what should I put for something??
Try one of this:
#define mbs_yysbuf // suggested by RoboTact
#define mbs_yysbuf __stdcall
#define mbs_yysbuf __cdecl
#define mbs_yysbuf __fastcall
#define mbs_yysbuf __thiscall
or any of above in combination with __declspec(import), like this:
#define mbs_yysbuf __declspec(import) __cdecl
-
June 16th, 2006, 09:48 AM
#8
Re: How to read this, it seems like it has two types
[QUOTE=Andrew Hain]The define you want is:
Code:
#define YY_PROTO (proto) proto
[QUOTE]
That should of course read:
Code:
#define YY_PROTO(proto) proto
without a space before the ( .
-
June 16th, 2006, 10:08 AM
#9
Re: How to read this, it seems like it has two types
Thanks for the reply, now I am facing two new errors, and I believe they are related.
I am getting two of the following error,
talk_ll.c(4376): error C2375: 'input' : redefinition; different linkage
talk_ll.c(6150): error C2375: 'input' : redefinition; different linkage
The program around line 4376 is
Code:
#ifndef YY_NO_INPUT
#ifdef __cplusplus
static int mbs_yyinput YY_PROTO(( void ));
#else
static int input YY_PROTO(( void )); <---- this is line 4376
#endif
#endif
The program around line 6150 is
Code:
#ifdef __cplusplus
static int mbs_mbs_yyinput()
#else
static int input()
#endif
{ <<--------- This is line 6150, but I believe the problem is coming from the above part
// This is middle code, but I don't think its important with the problem I am encoutering.
}
Basically, I think the problem might be the name of both parts are defined as "input". However, I cannot change anything inside this file (talk_ll.c) because it is directly coming from FLEX, the only file I can change is the header file (like, add define, add functions and stuff).
I tried to add
Code:
static int input();
into the header file, and that reduced to 1 error, saying
talk_ll.c(6150): error C2084: function 'int input()' already has a body
Does anyone know how to solve this?
Last edited by linhung; June 16th, 2006 at 10:12 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|