question

kavehrahimi-5744 avatar image
0 Votes"
kavehrahimi-5744 asked YujianYao-MSFT commented

Linkage problem

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++
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Castorix31 avatar image
0 Votes"
Castorix31 answered

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

 #pragma comment(lib, "your_library.lib")
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

YujianYao-MSFT avatar image
0 Votes"
YujianYao-MSFT answered YujianYao-MSFT commented

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.






· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @kavehrahimi-5744,

May I know if you have got any chance to check my answer? I am glad to help if you have any other questions.

0 Votes 0 ·