Results 1 to 3 of 3

Thread: Linker error when i link C code

  1. #1
    Join Date
    Aug 2008
    Posts
    134
    Thanks
    10
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Linker error when i link C code

    Hi,
    I have generated a library file which is written in C code. When i try to link in my QT main application its giving following
    error error LNK2019: unresolved external symbol "unsigned short __cdecl function..........."


    How can i resolve this????

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Linker error when i link C code

    two possibilites:
    * you do not really link against that library: (-l switch in gcc)
    * your header does not declare the functions as "C" functions and thus they were name mangled as C++ functions and thus are not found in the lib
    (though I guess that the __cdecl indicates that the error is rather the first one)

    HTH

  3. #3
    Join Date
    Aug 2008
    Posts
    134
    Thanks
    10
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Linker error when i link C code

    yes absolutely. I used extern "C" while including the C header file. working fine.


    Thank you

Similar Threads

  1. Replies: 1
    Last Post: 23rd October 2008, 15:02
  2. Qt Cryptographic Architecture
    By vermarajeev in forum Qt Programming
    Replies: 6
    Last Post: 9th February 2007, 13:15
  3. problem with linking
    By mickey in forum Qt Programming
    Replies: 49
    Last Post: 12th August 2006, 21:41

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.