Linkage problem

kaveh rahimi 61 Reputation points
2021-09-08T17:52:10.517+00:00

Hi , I have read your answer about my problem and didn't understand it . you told that application type is wrong . I have a header file the visual studio makes two errors about linkage . I don't know which type of application must I use for a header file?
The errors are LNK2019 and LNK1120
Please help me
Thanks

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,527 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Castorix31 81,726 Reputation points
    2021-09-08T18:03:02.85+00:00

    Add the matching .CPP for the .H or link with the .lib, with

    #pragma comment(lib, "your_library.lib")
    
    0 comments No comments

  2. YujianYao-MSFT 4,271 Reputation points Microsoft Vendor
    2021-09-20T09:52:20.46+00:00

    Hi,

    Reasons for LNK2019:

    An error occurred during the linking process. A common error is that you only include the header file but not the library file. You should check whether the file has been added correctly.

    Reasons for LNK1120:

    Only the declaration of the function, not the realization of the function, so the link can only be unsuccessful by compiling.

    You could refer to this document to add your own dynamic library.

    Best Regards,

    Elya


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.