Link error in MS Visual Studio 2022

461 views
Skip to first unread message

Felipe Rodriguez

unread,
May 7, 2023, 8:03:55 AM5/7/23
to dislin-users
Hello Dislin users,

I'm trying to use Dislin with MS Visual Studio 2022 for C++ and get the following link errors:

"
1>------ Build started: Project: test_dislin, Configuration: Debug x64 ------
1>test_dislin.cpp
1>test_dislin.obj : error LNK2019: unresolved external symbol "public: __cdecl Dislin::Dislin(void)" (??0Dislin@@QEAA@XZ) referenced in function main
1>test_dislin.obj : error LNK2019: unresolved external symbol "public: __cdecl Dislin::~Dislin(void)" (??1Dislin@@QEAA@XZ) referenced in function main
1>test_dislin.obj : error LNK2019: unresolved external symbol "public: void __cdecl Dislin::axsbgd(int)" (?axsbgd@Dislin@@QEAAXH@Z) referenced in function main
1>test_dislin.obj : error LNK2019: unresolved external symbol "public: void __cdecl Dislin::axslen(int,int)" (?axslen@Dislin@@QEAAXHH@Z) referenced in function main
1>test_dislin.obj : error LNK2019: unresolved external symbol "public: void __cdecl Dislin::axspos(int,int)" (?axspos@Dislin@@QEAAXHH@Z) referenced in function main
1>test_dislin.obj : error LNK2019: unresolved external symbol "public: void __cdecl Dislin::color(char const *)" (?color@Dislin@@QEAAXPEBD@Z) referenced in function main
1>test_dislin.obj : error LNK2019: unresolved external symbol "public: void __cdecl Dislin::complx(void)" (?complx@Dislin@@QEAAXXZ) referenced in function main
1>test_dislin.obj : error LNK2019: unresolved external symbol "public: void __cdecl Dislin::curve(double const *,double const *,int)" (?curve@Dislin@@QEAAXPEBN0H@Z) referenced in function main
1>test_dislin.obj : error LNK2019: unresolved external symbol "public: void __cdecl Dislin::disfin(void)" (?disfin@Dislin@@QEAAXXZ) referenced in function main
1>test_dislin.obj : error LNK2019: unresolved external symbol "public: void __cdecl Dislin::disini(void)" (?disini@Dislin@@QEAAXXZ) referenced in function main
1>test_dislin.obj : error LNK2019: unresolved external symbol "public: void __cdecl Dislin::graf(double,double,double,double,double,double,double,double)" (?graf@Dislin@@QEAAXNNNNNNNN@Z) referenced in function main
1>test_dislin.obj : error LNK2019: unresolved external symbol "public: void __cdecl Dislin::grid(int,int)" (?grid@Dislin@@QEAAXHH@Z) referenced in function main
1>test_dislin.obj : error LNK2019: unresolved external symbol "public: void __cdecl Dislin::height(int)" (?height@Dislin@@QEAAXH@Z) referenced in function main
1>test_dislin.obj : error LNK2019: unresolved external symbol "public: static int __cdecl Dislin::intrgb(double,double,double)" (?intrgb@Dislin@@SAHNNN@Z) referenced in function main
1>test_dislin.obj : error LNK2019: unresolved external symbol "public: void __cdecl Dislin::labdig(int,char const *)" (?labdig@Dislin@@QEAAXHPEBD@Z) referenced in function main
1>test_dislin.obj : error LNK2019: unresolved external symbol "public: void __cdecl Dislin::metafl(char const *)" (?metafl@Dislin@@QEAAXPEBD@Z) referenced in function main
1>test_dislin.obj : error LNK2019: unresolved external symbol "public: void __cdecl Dislin::name(char const *,char const *)" (?name@Dislin@@QEAAXPEBD0@Z) referenced in function main
1>test_dislin.obj : error LNK2019: unresolved external symbol "public: void __cdecl Dislin::pagera(void)" (?pagera@Dislin@@QEAAXXZ) referenced in function main
1>test_dislin.obj : error LNK2019: unresolved external symbol "public: void __cdecl Dislin::scrmod(char const *)" (?scrmod@Dislin@@QEAAXPEBD@Z) referenced in function main
1>test_dislin.obj : error LNK2019: unresolved external symbol "public: void __cdecl Dislin::setrgb(double,double,double)" (?setrgb@Dislin@@QEAAXNNN@Z) referenced in function main
1>test_dislin.obj : error LNK2019: unresolved external symbol "public: void __cdecl Dislin::ticks(int,char const *)" (?ticks@Dislin@@QEAAXHPEBD@Z) referenced in function main
1>test_dislin.obj : error LNK2019: unresolved external symbol "public: void __cdecl Dislin::title(void)" (?title@Dislin@@QEAAXXZ) referenced in function main
1>test_dislin.obj : error LNK2019: unresolved external symbol "public: void __cdecl Dislin::titlin(char const *,int)" (?titlin@Dislin@@QEAAXPEBDH@Z) referenced in function main
"

I followed the instructions provided in the FAQ section ("How can I use DISLIN with Microsoft Visual Studio C++ 2019/2022 ? "). Furthermore, when adding one of the C examples ("exa_c.c") from the folder C:\dislin\examples to an empty project then it works. It also works when for example copying the "Demonstration of CURVE / C", and add the file to the project.

But it doesn't work when I add to the project a C++ example ("exa_cpp.cpp") from the C:\dislin folder. It doesn't work either if I copy the C++ code example from "Demonstration of CURVE / C++" and then add this file to an empty project.

Any help is really appreciated.

Thanks.

Felipe

Helmut Michels

unread,
May 7, 2023, 12:07:07 PM5/7/23
to dislin-users
Dear Felipe,

for linking the example exa_cpp.cpp with Dislin you have to link with the Dislin library discpp.lib instead
of disvc.lib. The library is compiled for Release x64 and the multithread static runtime library (/MT).

With best regards,

Helmut

Felipe Rodriguez

unread,
May 7, 2023, 12:40:21 PM5/7/23
to dislin...@googlegroups.com
Hi Helmut,

Thanks for your reply. I have already added the "discpp.lib" in the Linker input:
image.png

Also, the other changes have already been done, but the linker issue persists.

"
Build started...

1>------ Build started: Project: test_dislin, Configuration: Debug x64 ------
1>exa_cpp.cpp
1>exa_cpp.obj : error LNK2019: unresolved external symbol _CrtDbgReport referenced in function "void * __cdecl std::_Allocate_manually_vector_aligned<struct std::_Default_allocate_traits>(unsigned __int64)" (??$_Allocate_manually_vector_aligned@U_Default_allocate_traits@std@@@std@@YAPEAX_K@Z)
1>libcpmtd.lib(xlocale.obj) : error LNK2001: unresolved external symbol _CrtDbgReport
1>libcpmtd.lib(locale.obj) : error LNK2001: unresolved external symbol _CrtDbgReport
1>libcpmtd.lib(wlocale.obj) : error LNK2001: unresolved external symbol _CrtDbgReport
1>libcpmtd.lib(xlocale.obj) : error LNK2019: unresolved external symbol _calloc_dbg referenced in function "char * __cdecl std::_Maklocstr<char>(char const *,char *,struct _Cvtvec const &)" (??$_Maklocstr@D@std@@YAPEADPEBDPEADAEBU_Cvtvec@@@Z)
1>libcpmtd.lib(_tolower.obj) : error LNK2001: unresolved external symbol _calloc_dbg
1>libcpmtd.lib(locale.obj) : error LNK2001: unresolved external symbol _calloc_dbg
1>libcpmtd.lib(wlocale.obj) : error LNK2001: unresolved external symbol _calloc_dbg
1>libcpmtd.lib(StlLCMapStringA.obj) : error LNK2001: unresolved external symbol _free_dbg
1>libcpmtd.lib(wlocale.obj) : error LNK2001: unresolved external symbol _free_dbg
1>libcpmtd.lib(xwcsxfrm.obj) : error LNK2001: unresolved external symbol _free_dbg
1>libcpmtd.lib(xlocale.obj) : error LNK2001: unresolved external symbol _free_dbg
1>libcpmtd.lib(locale0.obj) : error LNK2001: unresolved external symbol _free_dbg
1>libcpmtd.lib(locale.obj) : error LNK2001: unresolved external symbol _free_dbg
1>libcpmtd.lib(StlCompareStringA.obj) : error LNK2001: unresolved external symbol _free_dbg
1>libcpmtd.lib(StlLCMapStringA.obj) : error LNK2001: unresolved external symbol _malloc_dbg
1>libcpmtd.lib(wlocale.obj) : error LNK2001: unresolved external symbol _malloc_dbg
1>libcpmtd.lib(xwcsxfrm.obj) : error LNK2001: unresolved external symbol _malloc_dbg
1>libcpmtd.lib(xlocale.obj) : error LNK2001: unresolved external symbol _malloc_dbg
1>libcpmtd.lib(locale0.obj) : error LNK2001: unresolved external symbol _malloc_dbg
1>libcpmtd.lib(locale.obj) : error LNK2001: unresolved external symbol _malloc_dbg
1>libcpmtd.lib(StlCompareStringA.obj) : error LNK2001: unresolved external symbol _malloc_dbg
1>libcpmtd.lib(xstrcoll.obj) : error LNK2019: unresolved external symbol _wcsdup_dbg referenced in function _Getcoll
1>libcpmtd.lib(_tolower.obj) : error LNK2001: unresolved external symbol _wcsdup_dbg
1>libcpmtd.lib(locale.obj) : error LNK2019: unresolved external symbol _realloc_dbg referenced in function "private: static void __cdecl std::locale::_Locimp::_Locimp_Addfac(class std::locale::_Locimp *,class std::locale::facet *,unsigned __int64)" (?_Locimp_Addfac@_Locimp@locale@std@@CAXPEAV123@PEAVfacet@23@_K@Z)
1>libcpmtd.lib(StlCompareStringA.obj) : error LNK2019: unresolved external symbol _CrtDbgReportW referenced in function __crtCompareStringA
1>libcpmtd.lib(StlLCMapStringA.obj) : error LNK2001: unresolved external symbol _CrtDbgReportW
1>libcpmtd.lib(xmbtowc.obj) : error LNK2001: unresolved external symbol _CrtDbgReportW
"


Regards,
Felipe


--
You received this message because you are subscribed to the Google Groups "dislin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dislin-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dislin-users/a5b430f0-8476-4760-9b4d-6d6a16395600n%40googlegroups.com.

Helmut Michels

unread,
May 7, 2023, 12:52:52 PM5/7/23
to dislin-users
Yes, you are still in Debug and not in Release mode.

With best regards,

Helmut

Helmut Michels

unread,
May 7, 2023, 1:20:49 PM5/7/23
to dislin-users
Hi,

compiling and linking in Debug mode seems to work if you use the runtime library
LIBCMTD.lib (/MTd). Defaults libraries should be ignored in the linker settings for
suppressing some warnings.

With best regards,

Helmut

Felipe Rodriguez

unread,
May 7, 2023, 1:44:11 PM5/7/23
to dislin...@googlegroups.com
Hi Helmut,

Thank you very much! Now it works in "Release" mode.
One question, I'm not experienced with linking, but cannot find the LIBCMTD.libfile,
where is it located?

Br,

Felipe

You received this message because you are subscribed to a topic in the Google Groups "dislin-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dislin-users/Dd0hmc_lJz0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dislin-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dislin-users/8aa5cc9d-136c-4bc9-af67-30fda30016f8n%40googlegroups.com.

Helmut Michels

unread,
May 7, 2023, 4:20:43 PM5/7/23
to dislin-users
Hi Felipe,

you can select it in the Configuration Properties -> C/C++ > Code Generation property page of your
project.

With best regards,

Helmut

Felipe Rodriguez

unread,
May 8, 2023, 8:06:20 AM5/8/23
to dislin...@googlegroups.com
Hi Helmut,

Yes, now it works in DEBUG mode.

Thanks!

Br,
Felipe


Reply all
Reply to author
Forward
0 new messages