Compiling a Parser Generator generated file causes linker errors
-
Hello guys, I'm trying to build a simple lexical analyzer with Parser Generator 2. I wrote a Lex and a Yacc file and built a *.c and a *.h file with them. As I tried to compile this files I got strange linker errors: error LNK2019: unresolved external symbol _yywclex referenced in function _yywgettoken error LNK2019: unresolved external symbol _yywcparse referenced in function _main fatal error LNK1120: 2 unresolved externals What can I do against this errors, or do I have to use another compiler? Thanks and best wishes.
-
Hello guys, I'm trying to build a simple lexical analyzer with Parser Generator 2. I wrote a Lex and a Yacc file and built a *.c and a *.h file with them. As I tried to compile this files I got strange linker errors: error LNK2019: unresolved external symbol _yywclex referenced in function _yywgettoken error LNK2019: unresolved external symbol _yywcparse referenced in function _main fatal error LNK1120: 2 unresolved externals What can I do against this errors, or do I have to use another compiler? Thanks and best wishes.
Hi, Check if your functions are having same data type for the arguments in header file and c file Also see if you are having those functions definitions with declaration in header file or forward declaration in C file. Thanks, Suman
-- "Programming is an art that fights back!"
-
Hi, Check if your functions are having same data type for the arguments in header file and c file Also see if you are having those functions definitions with declaration in header file or forward declaration in C file. Thanks, Suman
-- "Programming is an art that fights back!"
-
All the function definitions are in the main file defined with prototypes, so I don't think it's something to do with them.
You make sure you have included all the headers you needed in c file and any libraries if needed. Also, all the files you have created are added to your project. And check if the path of included headers are correct. Thanks, Suman
-- "Programming is an art that fights back!"
-
You make sure you have included all the headers you needed in c file and any libraries if needed. Also, all the files you have created are added to your project. And check if the path of included headers are correct. Thanks, Suman
-- "Programming is an art that fights back!"
-
Hello guys, I'm trying to build a simple lexical analyzer with Parser Generator 2. I wrote a Lex and a Yacc file and built a *.c and a *.h file with them. As I tried to compile this files I got strange linker errors: error LNK2019: unresolved external symbol _yywclex referenced in function _yywgettoken error LNK2019: unresolved external symbol _yywcparse referenced in function _main fatal error LNK1120: 2 unresolved externals What can I do against this errors, or do I have to use another compiler? Thanks and best wishes.
Hi Without being funny, you have to do something all of us do most of the time, It's called debugging. You wrote the code, You know what's in it. And you Need to know what's in it!! As a Hint, it seems your linker missed a lib. Find out which one, and write: #pragma comment(lib,"MyMissing.Lib");
Bram van Kampen
-
Hi Without being funny, you have to do something all of us do most of the time, It's called debugging. You wrote the code, You know what's in it. And you Need to know what's in it!! As a Hint, it seems your linker missed a lib. Find out which one, and write: #pragma comment(lib,"MyMissing.Lib");
Bram van Kampen
-
I already tried debugging the project, but I just got the message that something is wrong with the linker.
Well, The functions yywclex(??) and yywcparse(??) have been declared, are being used in the stated modules, but have not been defined. That's why the linker cannot find them. Do a text search for these functions. If you cannot find a definition for them there may be something wrong with your generator. an other possibility is that you were supposed to write those yourself. Check the documentation for YACC. Thirdly, Is there a bug in your rules script, which results in YACC not generating those functions. It is unlikely that there is something wrong with your linker. Also, because the code is in 'C', errors in type declarations may cause a run time issue, but will not be found by the linker. The functions: 'int f(int)' and 'int f(char,char) are both mangled to '_f' by the compiler. Hope this helps :)
Bram van Kampen
-
Well, The functions yywclex(??) and yywcparse(??) have been declared, are being used in the stated modules, but have not been defined. That's why the linker cannot find them. Do a text search for these functions. If you cannot find a definition for them there may be something wrong with your generator. an other possibility is that you were supposed to write those yourself. Check the documentation for YACC. Thirdly, Is there a bug in your rules script, which results in YACC not generating those functions. It is unlikely that there is something wrong with your linker. Also, because the code is in 'C', errors in type declarations may cause a run time issue, but will not be found by the linker. The functions: 'int f(int)' and 'int f(char,char) are both mangled to '_f' by the compiler. Hope this helps :)
Bram van Kampen
-
I solved this problem by rebuilding all the library files which are included. Now there's just one erroe left, but I don't thnk that this one has something to do with VC++, but with the lexer and parser generator I'm using.
Well, at least you're getting a handle on things. Gives a good feeling though, doesn't it. Regards, :) :)
Bram van Kampen