Menu

#15 LNK2019 errors when compiling libVISCA in VS2012

v1.0 (example)
closed
None
5
2017-02-26
2016-07-07
David Andes
No

When compiling libvisca.h and libvisca.c from 1.1.0 to make a static library in VS2012, I receive the following errors:

1>libvisca.obj : error LNK2019: unresolved external symbol __VISCA_write_packet_data referenced in function _VISCA_get_camera_info
1>libvisca.obj : error LNK2019: unresolved external symbol __VISCA_send_packet referenced in function _VISCA_clear
1>libvisca.obj : error LNK2019: unresolved external symbol __VISCA_get_packet referenced in function __VISCA_get_reply

In reviewing the source for libvisca.c, it appears the functions VISCA_write_packetdata, VISCA_send_packet and VISCA_get_packet are each undefined.

Am I missing something?

Discussion

  • Damien Douxchamps

    Hi,

    I'm not exactly knowledgeable in windows stuff, but here's a few pointers that may help.
    No function is called __VISCA_write_packet (same for the two other undefined ones). But _VISCA_write_packet (single underscore) and friends are defined in libvisca_win32.c. I assume the extra underscore is something about the windows compiler, so if the 3 functions are not found it's possible that the file libvisca_win32.c is not compiled properly?

    Damien

     
  • David Andes

    David Andes - 2016-07-15

    Oh my goodness. I am so embarassed to have missed that! I guess that's what I get for coding while NOT under the influence of caffeine!

    Please close the ticket as Solved: User is an idiot.

     
  • Damien Douxchamps

    :-)

     
  • Damien Douxchamps

    • status: open --> closed
    • assigned_to: Damien Douxchamps
     
  • Rupesh

    Rupesh - 2017-02-26

    Dear Sir,
    I am using PIC MICROCONTROLLER

    In this function I can't understand WriteFile function,because of this
    function your code in not working in my compiler.

    uint32_t
    _VISCA_write_packet_data(VISCAInterface_t iface, VISCACamera_t camera,
    VISCAPacket_t packet)
    {
    DWORD iBytesWritten;

    WriteFile(iface->port_fd, packet->bytes, packet->length,
    &iBytesWritten, NULL);
    if ( iBytesWritten < packet->length )
    return VISCA_FAILURE;
    else
    return VISCA_SUCCESS;
    }
    2nd doubt In this function I can't understand ReadFile *function,because
    of this function your code in not working in my compiler.

    uint32_t
    _VISCA_get_packet(VISCAInterface_t *iface)
    {
    int pos=0;
    BOOL rc;
    DWORD iBytesRead;

    // wait for message
    rc=ReadFile(iface->port_fd, iface->ibuf, 1, &iBytesRead, NULL);
    if ( !rc || iBytesRead==0 )
    {
    // Obtain the error code
    //m_lLastError = ::GetLastError();
    _RPTF0(_CRT_WARN,"ReadFile failed.\n");
    return VISCA_FAILURE;
    }
    while (iface->ibuf[pos]!=VISCA_TERMINATOR) {
    if ( ++pos >= VISCA_INPUT_BUFFER_SIZE )
    {
    // Obtain the error code
    //m_lLastError = ::GetLastError();
    _RPTF0(_CRT_WARN,"illegal reply packet.\n");
    return VISCA_FAILURE;
    }
    rc=ReadFile(iface->port_fd, iface->ibuf + pos, 1, &iBytesRead, NULL);
    if ( !rc || iBytesRead==0 )
    {
    // Obtain the error code
    //m_lLastError = ::GetLastError();
    _RPTF0(_CRT_WARN,"ReadFile failed.\n");
    return VISCA_FAILURE;
    }
    }
    iface->bytes=pos+1;

    return VISCA_SUCCESS;
    }
    rest of thing are understandable

    Please give response joshirupesh1989@gmail.com

     

Log in to post a comment.

MongoDB Logo MongoDB