Link errors

Discussion in 'C Programming' started by ermanu@hotmail.com, Jan 30, 2006.

  1. Guest

    Hello we don't know much about C. But we have to resolve this problem
    in order to work on our project.
    We're getting below errors whenever we try to build the code. We're
    trying to build the code in Visual Studio C++. Here are the errors:
    -------------------------------------------
    test error LNK2019: unresolved external symbol _find_child_nxpv
    referenced in function "void __cdecl processFile(char const *)"
    (?processFile@@YAXPBD@Z)
    test error LNK2019: unresolved external symbol _nxpv_to_str referenced
    in function "void __cdecl processFile(char const *)"
    (?processFile@@YAXPBD@Z)
    test error LNK2019: unresolved external symbol _receive_response
    referenced in function "void __cdecl processFile(char const *)"
    (?processFile@@YAXPBD@Z)
    test error LNK2019: unresolved external symbol _delete_nxpv referenced
    in function "void __cdecl processFile(char const *)"
    (?processFile@@YAXPBD@Z)
    test error LNK2019: unresolved external symbol _send_request referenced
    in function "void __cdecl processFile(char const *)"
    (?processFile@@YAXPBD@Z)
    test error LNK2019: unresolved external symbol _str_to_nxpv referenced
    in function "void __cdecl processFile(char const *)"
    (?processFile@@YAXPBD@Z)
    test fatal error LNK1120: 6 unresolved externals
    ----------------------------------------------

    and the code is

    -----------------------------------------------

    /* process request from file */

    #include <stdio.h>

    #include <string.h>

    #include <stdlib.h>

    #include "nx_capi.h"

    /* #include "nx_defs.h" */

    /* #include "nx_parser.h" */



    void processFile(const char* fName)

    {

    FILE* fin;

    if (!fName)

    {

    printf("Null file name.\n");

    return;

    }

    /* open the file */

    fin = fopen(fName, "r");

    if (!fin)

    {

    printf("Could not open %s\n", fName);

    return;

    }

    else

    {

    char buff[MAX_FILE_SIZE];

    pv_NXPV * req = 0;

    int num_read = 0;

    if (0 == (num_read = fread(buff, sizeof(char), MAX_FILE_SIZE, fin)))

    {

    printf("Nothing read from %s\n", fName);

    return;

    }

    /* null terminate the buffer */

    if (num_read < MAX_FILE_SIZE)

    buff[num_read] = '\0';

    else

    {

    buff[MAX_FILE_SIZE - 1] = '\0';

    printf("Buffer truncated.\n");

    }

    /* convert buffer to request tree */

    req = str_to_nxpv(buff);

    /* send request */

    if (FAILURE == send_request(req))

    {

    printf("Request error.\n");

    delete_nxpv (req);

    }

    else

    {

    /* receive response -- could be a series of responses

    from a query */

    char statusStr[20];

    do

    {

    pv_NXPV * resp = 0;

    pv_NXPV * status = 0;

    if (FAILURE == receive_response( &resp ))

    {

    printf("Reponse error\n");

    break;

    }

    else

    {

    /* convert response tree to string */

    nxpv_to_str(resp, buff, sizeof(buff));

    printf("Reponse:\n%s\n", buff);

    status = find_child_nxpv(resp, stat_label);

    if (!status)

    {

    printf("No status.\n");

    break;

    }

    strcpy(statusStr, status->value);

    delete_nxpv(resp);

    resp = 0;

    }

    } while(!strcmp(statusStr, "PROCESSING"));

    }

    /* clean up heap */ delete_nxpv (req);

    }

    } /* end of processFile */

    main(int argc, char** argv)

    {

    int c;

    for (c = 1; c < argc; c++)

    processFile(argv[c]);

    exit(0);

    }

    /* end of main */


    What can we do? What's the problem
    Thank you
    , Jan 30, 2006
    #1
    1. Advertising

  2. [OT] Re: Link errors

    wrote:
    > Hello we don't know much about C. But we have to resolve this problem
    > in order to work on our project.
    > We're getting below errors whenever we try to build the code. We're
    > trying to build the code in Visual Studio C++. Here are the errors:


    Your code is very badly indented, possibly the result of pasting into
    your newsreader (try not using TABs in your source).

    Your problem seems to be that you don't provide object files with the
    functions you call in the code below to the linker. Your error messages
    say as much. I might add that this is at least slightly off topic here,
    as it's not a C language problem as such. It's more of a "your use of
    your C language toolset" type of problem.

    > -------------------------------------------
    > test error LNK2019: unresolved external symbol _find_child_nxpv
    > referenced in function "void __cdecl processFile(char const *)"
    > (?processFile@@YAXPBD@Z)
    > test error LNK2019: unresolved external symbol _nxpv_to_str referenced
    > in function "void __cdecl processFile(char const *)"
    > (?processFile@@YAXPBD@Z)
    > test error LNK2019: unresolved external symbol _receive_response
    > referenced in function "void __cdecl processFile(char const *)"
    > (?processFile@@YAXPBD@Z)
    > test error LNK2019: unresolved external symbol _delete_nxpv referenced
    > in function "void __cdecl processFile(char const *)"
    > (?processFile@@YAXPBD@Z)
    > test error LNK2019: unresolved external symbol _send_request referenced
    > in function "void __cdecl processFile(char const *)"
    > (?processFile@@YAXPBD@Z)
    > test error LNK2019: unresolved external symbol _str_to_nxpv referenced
    > in function "void __cdecl processFile(char const *)"
    > (?processFile@@YAXPBD@Z)
    > test fatal error LNK1120: 6 unresolved externals
    > ----------------------------------------------
    >


    <snipped the code, as it's not relevant to the problem>

    >
    > What can we do? What's the problem
    > Thank you


    Providing the source or object files with the functions you use should
    fix this (it seems that you include appropriate headers, as the
    compiler does not complain).

    Cheers

    Vladimir
    Vladimir S. Oka, Jan 30, 2006
    #2
    1. Advertising

  3. CBFalconer Guest

    wrote:
    >
    > Hello we don't know much about C. But we have to resolve this problem
    > in order to work on our project.
    > We're getting below errors whenever we try to build the code. We're
    > trying to build the code in Visual Studio C++. Here are the errors:
    >

    .... snip ...
    >
    > What can we do? What's the problem


    The code you supplied is practically unreadable, due to the double
    spacing and lack of indentation. This may be due to your using
    tabs (rather than spaces) in the source. The double spacing
    probably results from something in your mailer confusing dos eol
    <cr,lf> with l/unix eol <lf> or something similar.

    After that you have to eliminate the non-standard #includes
    ("nx_capi.h") or supply them in your post, together with the source
    of whatever routines referenced therein. That source must be in
    purely standard C to be understandable here.

    Since the errors are happening at link time, you are probably
    omitting a library from the final compilation command. Any such
    details are off-topic here, since they have nothing to do with the
    language, but only the implementation. For help on that find a
    newsgroup that deals with your particular system. It probably has
    Microsoft in its name.

    --
    "The power of the Executive to cast a man into prison without
    formulating any charge known to the law, and particularly to
    deny him the judgement of his peers, is in the highest degree
    odious and is the foundation of all totalitarian government
    whether Nazi or Communist." -- W. Churchill, Nov 21, 1943
    CBFalconer, Jan 30, 2006
    #3
  4. writes:
    > Hello we don't know much about C. But we have to resolve this problem
    > in order to work on our project.
    > We're getting below errors whenever we try to build the code. We're
    > trying to build the code in Visual Studio C++. Here are the errors:
    > -------------------------------------------
    > test error LNK2019: unresolved external symbol _find_child_nxpv
    > referenced in function "void __cdecl processFile(char const *)"
    > (?processFile@@YAXPBD@Z)
    > test error LNK2019: unresolved external symbol _nxpv_to_str referenced
    > in function "void __cdecl processFile(char const *)"
    > (?processFile@@YAXPBD@Z)
    > test error LNK2019: unresolved external symbol _receive_response
    > referenced in function "void __cdecl processFile(char const *)"
    > (?processFile@@YAXPBD@Z)
    > test error LNK2019: unresolved external symbol _delete_nxpv referenced
    > in function "void __cdecl processFile(char const *)"
    > (?processFile@@YAXPBD@Z)
    > test error LNK2019: unresolved external symbol _send_request referenced
    > in function "void __cdecl processFile(char const *)"
    > (?processFile@@YAXPBD@Z)
    > test error LNK2019: unresolved external symbol _str_to_nxpv referenced
    > in function "void __cdecl processFile(char const *)"
    > (?processFile@@YAXPBD@Z)
    > test fatal error LNK1120: 6 unresolved externals
    > ----------------------------------------------


    Find out which library or libraries contain the symbols
    _find_child_nxpv or find_child_nxpv, and so on for all the others in
    the error messages. (Some implementations prepend an underscore to
    external symbols.) Make sure your linker is including those
    libraries. The order in which they're specified might be significant.

    For details, see your system's documentation and/or post to a
    newsgroup that deals with Visual Studio C++.

    Incidentally, the name "Visual Studio C++" implies that it's a C++
    compiler, not a C compiler, making it off-topic here. I *think* it
    can be used as a C compiler, but it would be a good idea to mention
    explicitly that you're using it that way. We do get a lot of people
    asking here about C++ problems.

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
    We must do something. This is something. Therefore, we must do this.
    Keith Thompson, Jan 30, 2006
    #4
  5. On Mon, 30 Jan 2006 19:19:20 GMT, in comp.lang.c , Keith Thompson
    <> wrote:

    >Incidentally, the name "Visual Studio C++" implies that it's a C++
    >compiler, not a C compiler, making it off-topic here.


    This is true, but the undecorated names tell you he's compiled it in C
    mode. Mind you, this is an offtopic observation.

    Mark McIntyre
    --
    "Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are,
    by definition, not smart enough to debug it."
    --Brian Kernighan

    ----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
    http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
    ----= East and West-Coast Server Farms - Total Privacy via Encryption =----
    Mark McIntyre, Jan 30, 2006
    #5
  6. CBFalconer Guest

    Mark McIntyre wrote:
    > Keith Thompson <> wrote:
    >
    >> Incidentally, the name "Visual Studio C++" implies that it's a
    >> C++ compiler, not a C compiler, making it off-topic here.

    >
    > This is true, but the undecorated names tell you he's compiled
    > it in C mode. Mind you, this is an offtopic observation.


    I never thought of that. Shows how often I use C++.

    --
    "The power of the Executive to cast a man into prison without
    formulating any charge known to the law, and particularly to
    deny him the judgement of his peers, is in the highest degree
    odious and is the foundation of all totalitarian government
    whether Nazi or Communist." -- W. Churchill, Nov 21, 1943
    CBFalconer, Jan 31, 2006
    #6
  7. ais523 Guest

    wrote:
    <snip>
    > test error LNK2019: unresolved external symbol _find_child_nxpv
    > referenced in function "void __cdecl processFile(char const *)"
    > (?processFile@@YAXPBD@Z)
    > test error LNK2019: unresolved external symbol _nxpv_to_str referenced
    > in function "void __cdecl processFile(char const *)"
    > (?processFile@@YAXPBD@Z)
    > test error LNK2019: unresolved external symbol _receive_response
    > referenced in function "void __cdecl processFile(char const *)"
    > (?processFile@@YAXPBD@Z)
    > test error LNK2019: unresolved external symbol _delete_nxpv referenced
    > in function "void __cdecl processFile(char const *)"
    > (?processFile@@YAXPBD@Z)
    > test error LNK2019: unresolved external symbol _send_request referenced
    > in function "void __cdecl processFile(char const *)"
    > (?processFile@@YAXPBD@Z)
    > test error LNK2019: unresolved external symbol _str_to_nxpv referenced
    > in function "void __cdecl processFile(char const *)"
    > (?processFile@@YAXPBD@Z)

    <snip>

    Later in the same thread, Mark McIntyre wrote:

    > On Mon, 30 Jan 2006 19:19:20 GMT, in comp.lang.c , Keith Thompson
    > <> wrote:
    >
    > >Incidentally, the name "Visual Studio C++" implies that it's a C++
    > >compiler, not a C compiler, making it off-topic here.

    >
    > This is true, but the undecorated names tell you he's compiled it in C
    > mode. Mind you, this is an offtopic observation.
    >
    > Mark McIntyre


    <OT>
    Are you sure? To me, '?processFile@@YAXPBD@Z' looks like a C++-style
    mangled function name, showing that it was compiled as C++ after all.
    </OT>
    ais523, Jan 31, 2006
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark Goldin

    Errors, errors, errors

    Mark Goldin, Jan 17, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    926
    Mark Goldin
    Jan 17, 2004
  2. Kevin Spencer

    Re: Link Link Link DANGER WILL ROBINSON!!!

    Kevin Spencer, May 17, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    797
    Kevin Spencer
    May 17, 2005
  3. SenthilVel
    Replies:
    0
    Views:
    931
    SenthilVel
    Jun 7, 2006
  4. George1776

    Out-of-memory errors and caching errors.

    George1776, Aug 28, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    1,267
    George1776
    Sep 14, 2006
  5. Lance Wynn
    Replies:
    1
    Views:
    1,814
    Lance Wynn
    Feb 3, 2008
Loading...

Share This Page