How do I resolve LNK2019 error?

keke wang 0 Reputation points
2023-03-23T01:52:43.66+00:00

I created a dll and console program, and an LNK2019 error occurred when linking the dll. How can I resolve it?

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,518 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Minxin Yu 9,866 Reputation points Microsoft Vendor
    2023-03-23T07:49:03.3733333+00:00

    Hi,

    You need to add path in Project's. Properties -> Linker -> Additional Library Directories and add TheLibName.lib in Properties -> Linker -> Input -> Additional dependencies

    Best regards,

    Minxin Yu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    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.

    0 comments No comments

  2. RLWA32 40,021 Reputation points
    2023-03-23T08:44:17.59+00:00

    If your console application project and your DLL project are in the same solution you can resolve a LNK2019 error that looks like this -

    lnk2019

    by adding a reference to the Dll project in the console application project. For example, in the Solution Explorer pane of the Visual Studio IDE -

    Before adding reference -

    Before

    After adding reference -

    After

    0 comments No comments