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.
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?
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.
Re: How to read this, it seems like it has two types
Brilliant. :rolleyes:
add to get rid of it.
Re: How to read this, it seems like it has two types
Quote:
Originally Posted by RoboTact
Brilliant. :rolleyes:
add
to get rid of it.
Shouldnt I use #define mbs_yysbuf something, what should I put for something??
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.
Re: How to read this, it seems like it has two types
Quote:
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
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 ( .
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?