| |

VerySource

 Forgot password?
 Register
Search
View: 630|Reply: 7

A Link2001 error issue: unresolved external symbol "__declspec (dllimport) ...

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-3-6 12:00:01
| Show all posts |Read mode
I created a new Win32 Dynamic-Link Library project and added the most basic framework code (test.cpp). Everything is fine.
I need to reference the files of the jrtplib library in the project. The operation is as follows:
Added jthread.lib jrtplib.lib (two required libraries) in project | Settings | Link;
Created a new CRtp class to specifically operate jrtplib related functions;
Added the most basic framework code in CRtp; (if it is an exe project, there is no problem at all)
Then include rtp.h in test.cpp ...

rtplibd.lib (rtpudpv4transmitter.obj): error LNK2001: unresolved external symbol "__declspec (dllimport) public: char const * __thiscall std :: basic_string <char, struct std :: char_traits <char>, class std :: allocator <char> > :: c_str (void) const "(__imp_? c_
str @? $ basic_string @ DU? $ char_traits @ D @ std @@ V? $ allocator @ D @ 2 @@ std @@ QBEPBDXZ)
jrtplibd.lib (rtpudpv4transmitter.obj): error LNK2001: unresolved external symbol "__declspec (dllimport) public: unsigned int __thiscall std :: basic_string <char, struct std :: char_traits <char>, class std :: allocator <char>> :: length (void) const "(__imp_? l
ength @? $ basic_string @ DU? $ char_traits @ D @ std @@ V? $ allocator @ D @ 2 @@ std @@ QBEIXZ)
jrtplibd.lib (rtpudpv4transmitter.obj): error LNK2001: unresolved external symbol "__declspec (dllimport) public: static unsigned int const std :: basic_string <char, struct std :: char_traits <char>, class std :: allocator <char> > :: npos "(__imp_? npos @? $ basic_
string @ DU? $ char_traits @ D @ std @@ V? $ allocator @ D @ 2 @@ std @@ 2IB)
jrtplibd.lib (rtpudpv4transmitter.obj): error LNK2001: unresolved external symbol "__declspec (dllimport) public: unsigned int __thiscall std :: basic_string <char, struct std :: char_traits <char>, class std :: allocator <char>> :: find (char, unsigned int) const
"(__imp_? find @? $ basic_string @ DU? $ char_traits @ D @ std @@ V? $ allocator @ D @ 2 @@ std @@ QBEIDI @ Z)
jrtplibd.lib (rtpudpv4transmitter.obj): error LNK2001: unresolved external symbol "__declspec (dllimport) public: __thiscall std :: basic_string <char, struct std :: char_traits <char>, class std :: allocator <char>> :: ~ basic_string <char, struct std :: char_traits
<char>, class std :: allocator <char>> (void) "(__imp _ ?? 1? $ basic_string @ DU? $ char_traits @ D @ std @@ V? $ allocator @ D @ 2 @@ std @@ QAE @XZ)
jrtplibd.lib (rtpudpv4transmitter.obj): error LNK2001: unresolved external symbol "__declspec (dllimport) bool __cdecl std :: operator == (class std :: basic_string <char, struct std :: char_traits <char>, class std :: allocator <char>> const&, class std :: basic_st
ring <char, struct std :: char_traits <char>, class std :: allocator <char>> const&) "(__imp _ ?? 8std @@ YA_NABV? $ basic_string @ DU? $ char_traits @ D @ std @@ V? $ allocator @ D @ 2 @@ 0 @ 0 @ Z)
jrtplibd.lib (rtpudpv4transmitter.obj): error LNK2001: unresolved external symbol "__declspec (dllimport) public: __thiscall std :: basic_string <char, struct std :: char_traits <char>, class std :: allocator <char>> :: basic_string <char, struct std :: char_traits <
char>, class std :: allocator <char>> (char const *, class std :: allocator <char> const&) "(__imp _ ?? 0? $ basic_string @ DU? $ char_traits @ D @ std @@ V? $ allocator @ D @ 2 @@ std @@ QAE @ PBDABV? $ allocator @ D @ 1 @@ Z)
jrtplibd.lib (rtpudpv4transmitter.obj): error LNK2001: unresolved external symbol "__declspec (dllimport) public: __thiscall std :: ios_base :: Init :: Init (void)" (__imp _ ?? 0Init @ ios_base @ std @@ QAE @@ XZ)
jrtplibd.lib (rtppollthread.obj): error LNK2001: unresolved external symbol "__declspec (dllimport) public: __thiscall std :: ios_base :: Init :: Init (void)" (__imp _ ?? 0Init @ ios_base @ std @@ QAE @ XZ)
jrtplibd.lib (rtpudpv4transmitter.obj): error LNK2001: unresolved external symbol "__declspec (dllimport) public: __thiscall std :: ios_base :: Init :: ~ Init (void)" (__imp _ ?? 1Init @ ios_base @ std @@ QAE @XZ)
jrtplibd.lib (rtppollthread.obj): error LNK2001: unresolved external symbol "__declspec (dllimport) public: __thiscall std :: ios_base :: Init :: ~ Init (void)" (__imp _ ?? 1Init @ ios_base @ std @@ QAE @XZ)
jrtplibd.lib (rtpudpv4transmitter.obj): error LNK2001: unresolved external symbol "__declspec (dllimport) public: __thiscall std :: _ Winit :: _ Winit (void)" (__imp _ ?? 0_Winit @ std @@ QAE @ XZ)
jrtplibd.lib (rtppollthread.obj): error LNK2001: unresolved external symbol "__declspec (dllimport) public: __thiscall std :: _ Winit :: _ Winit (void)" (__imp _ ?? 0_Winit @ std @@ QAE @ XZ)
jrtplibd.lib (rtpudpv4transmitter.obj): error LNK2001: unresolved external symbol "__declspec (dllimport) public: __thiscall std :: _ Winit :: ~ _Winit (void)" (__imp _ ?? 1_Winit @ std @@ QAE @ XZ)
jrtplibd.lib (rtppollthread.obj): error LNK2001: unresolved external symbol "__declspec (dllimport) public: __thiscall std :: _ Winit :: ~ _Winit (void)" (__imp _ ?? 1_Winit @ std @@ QAE @ XZ)
jrtplibd.lib (rtpudpv4transmitter.obj): error LNK2001: unresolved external symbol "__declspec (dllimport) bool __cdecl std :: operator <(class std :: basic_string <char, struct std :: char_traits <char>, class std :: allocator <char>> const&, class std :: basic_str
ing <char, struct std :: char_traits <char>, class std :: allocator <char>> const&) "(__imp _ ?? Mstd @@ YA_NABV? $ basic_string @ DU? $ char_traits @ D @ std @@ V? $ allocator @ D @ 2 @@ 0 @ 0 @ Z)
jrtplibd.lib (rtpudpv4transmitter.obj): error LNK2001: unresolved external symbol "__declspec (dllimport) public: __thiscall std :: basic_string <char, struct std :: char_traits <char>, class std :: allocator <char>> :: basic_string <char, struct std :: char_traits <
char>, class std :: allocator <char>> (class std :: basic_string <char, struct std :: char_traits <char>, class std :: allocator <char>> const&) "(__imp _ ?? 0? $ basic_string @ DU? $ char_traits @ D @ std @@ V? $ allocator @ D @ 2 @@ std @@ QAE @ ABV01 @@ Z)
jrtplibd.lib (rtppollthread.obj): error LNK2001: unresolved external symbol "__declspec (dllimport) public: class std :: basic_ostream <char, struct std :: char_traits <char>>&__thiscall std :: basic_ostream <char, struct std :: char_traits <char>> :: operator <<
(class std :: basic_ostream <char, struct std :: char_traits <char>>&(__cdecl *) (class std :: basic_ostream <char, struct std :: char_traits <char>>&)) "(__imp _ ?? 6 ? $ basic_ostream @ DU? $ char_traits @ D @ std @@@ std @@ QAEAAV01 @ P6AAAV01 @ AAV01 @@ Z @ Z)
jrtplibd.lib (rtppollthread.obj): error LNK2001: unresolved external symbol "__declspec (dllimport) class std :: basic_ostream <char, struct std :: char_traits <char>>&__cdecl std :: operator << (class std ::: basic_ostream <char, struct std :: char_traits <char>>
&, char const *) "(__imp _ ?? 6std @@ YAAAV? $ Basic_ostream @ DU? $ Char_traits @ D @ std @@@ 0 @ AAV10 @ PBD @ Z)
jrtplibd.lib (rtppollthread.obj): error LNK2001: unresolved external symbol "__declspec (dllimport) class std :: basic_ostream <char, struct std :: char_traits <char>> std :: cerr" (__imp_? cerr @ std @@ 3V? $ Basic_ostream @ DU? $ Char_traits @ D @ std @@@ 1 @ A)
jrtplibd.lib (rtppollthread.obj): error LNK2001: unresolved external symbol "__declspec (dllimport) class std :: basic_ostream <char, struct std :: char_traits <char>>&__cdecl std :: endl (class std :: basic_ostream < char, struct std :: char_traits <char>>&) "(_
_imp_? endl @ std @@ YAAAV? $ basic_ostream @ DU? $ char_traits @ D @ std @@@ 1 @ AAV21 @@ Z)
Debug / testlib.ax: fatal error LNK1120: 17 unresolved externals

How can I solve this? Thank you
---------------------------------------------------------
Other clues reference:
Because this Dll development needs, Ignore all default libraries is selected in the Project | Settings | C / C ++ | Calling convention selection __stdcall. Settings | Link. If you do not select this, another link error occurs:
LIBCMTD.lib (dbgheap.obj): error LNK2015: __malloc_dbg already defined in msvcrtd.lib (MSVCRTD.dll)
LIBCMTD.lib (dbgheap.obj): error LNK2015: __free_dbg already defined in msvcrtd.lib (MSVCRTD.dll)
LIBCMTD.lib (crt0init.obj): error LNK2015: ___xc_z already defined in msvcrtd.lib (cinitexe.obj)
LIBCMTD.lib (crt0init.obj): error LNK2015: ___xc_a already defined in msvcrtd.lib (cinitexe.obj) ...
Reply

Use magic Report

0

Threads

32

Posts

27.00

Credits

Newbie

Rank: 1

Credits
27.00

 Invalid IP Address

Post time: 2020-5-22 19:45:01
| Show all posts
First restore the changes to the Ignore all default libraries option.
It may be caused by missing header file, it looks like it needs to include string.h
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-5-31 03:00:02
| Show all posts
Ignore all default libraries remove the LNK2015 errors like the ones mentioned above.
The error should be related to the library file, not the include.h file ... Because I applied jrtplib in the .exe project is completely normal, there is no such thing as __declspec (dllimport)
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-9-4 10:30:01
| Show all posts
Everyone, I encountered a similar problem: error LNK2001: unresolved external symbol "__declspec(dllimport) public: class _com_ptr_t<class _com_IIID<struct _Connection,&struct __s_GUID _GUID_00001550_0000_0010_8000_00aa006d2ea4> Please help! CADOConnection: Help! CADO! !
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-9-5 11:45:01
| Show all posts
I encountered this problem because the external friend function was set to inline. Just remove the inline. I do not know why the original poster. You can try it.
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-9-5 12:00:01
| Show all posts
It is caused by the lack of reference libraries.
The landlord can check the libraries and header files that he refers to.
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-9-6 17:00:01
| Show all posts
Library file
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-9-6 17:15:01
| Show all posts
Check whether the header file of this library is included, and check whether your lib is placed in the location pointed to by the additional library directory. It may be that the lib is not found.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list