mercredi 12 avril 2023

I am getting error LNK2019: : unresolved external symbol for my TEST project which is testing a project of .dll type

I am using Microsoft Native Visual C++ unit test (.NET frame work 4.5). I am creating TEST project in visual studio 2012 for my "xyz project", which has a configuration type Dynamic library(Properties->Configuration Properties->General). I am calling methods from TEST project which are defined in "xyz project". I am adding the proper header file ,in test.cpp and xyz.dll in Linker->Input->Additional Dependencies for TEST project.

The problem will arise only when I build my TEST project. The error says "error LNK2019: unresolved external symbol "public: bool __thiscall xyz_comm::send(void *,class xyz_Node *,int *). As far as I understand this error should not come as I already added xyz.dll( path is proper and there is no spelling or syntax issue).

My solution: After scratching my head a lot, I find out a work around. When I change the configuration (Properties->Configuration Properties->General) of test project from Dynamic library(.dll) to static library (.lib) shockingly this issue is resolved.

My Question:

  1. How can I resolve my error by keeping the configuration as Dynamic library(.dll) and build it without error.
  2. Does Microsoft Native Visual C++ unit test support testing for .dll project or not? If not which C++ test frameworks support .dll project testing

Aucun commentaire:

Enregistrer un commentaire