Linking error in visual studio C++ 2010
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Linking error in visual studio C++ 2010

  1. #1
    Join Date
    Jun 2011
    Posts
    19

    Linking error in visual studio C++ 2010

    I am using MS visual studio 2010 for building a C project. My project uses flex and bison for parsing purpose. When I build the project there is no error in compiling but error in linking.
    Following is the error:


    proparse.obj:could not resolved the pro_lex referenced in the function pro_parse

    Now,pro_lex is the function defined in the lex file. Lets say pro.lex. I used flex to generate the pro.c .And this function is defined and called as follows:

    In prolex.c

    #ifndef YY_ABCD
    #define YY_ABCD 1

    extern int pro_lex (void);

    #define YY_ABCD int pro_lex (void)
    #endif

    YY_ABCD{ /*This is the main function which does all the lexical function
    .....
    ........}


    And the yacc file proparse.y generates two file using bison viz proparse.h and proparse.c . The functions pro_lex and pro_parse are defined in the proparse.c as follows.

    In proparse.c


    #define yyparse pro_parse
    #define yylex pro_lex

    int yylex(void); /*defined in lex file
    .
    .
    .
    pro_parse(); /*parsing function is called.


    Could you please let me know what can be the reason for it? I would also like to know if I can set some rules to link certain object files in the IDE. I think it is getting this error
    becasue of the inability of linking. I would be glad if you could let me know if I can set some rules so that these two files can link.

    Many thanks in advance.
    Last edited by __bairagi; July 7th, 2011 at 06:20 PM.

  2. #2
    Join Date
    Apr 1999
    Posts
    27,427

    Re: Linking error in visual studio C++ 2010

    Quote Originally Posted by __bairagi View Post
    is no error in compiling but error in linking.
    Following is the error:

    proparse.obj:could not resolved the pro_lex referenced in the function pro_parse
    That couldn't be the exact error message from the Microsoft linker. Please post the exact message you are receiving.
    Now,pro_lex is the function defined in the lex file. Lets say pro.lex. I used flex to generate the pro.c .And this function is defined and called as follows:
    You posted only function declarations, not actual function implementations. Where are the actual functions implemented?

    Also, use code tags when posting code. Then there is no need for "......" in your post.
    Could you please let me know what can be the reason for it?
    All a declaration does is tell the compiler that a function exists somewhere. The linker now wants to know more -- where is the function? That's the reason for the error.

    Regards,

    Paul McKenzie

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center