0

I am using C++ on VS 2019. I created a C++ project library for auxiliary math functions and I was trying to test my code using the provided unit test tools for c++ inside. I just started and immediately I got blocked.

Platform:VS2019 (v142).

Configuration type: Dynamic Library .dll

Windows SDK Version: 10.0

Common Language Runtime Support: Common Language RunTime Support (/clr)

Compiler command line:

/Yu"pch.h" /GS /TP /analyze- /W3 /Zc:wchar_t /I"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\UnitTest\include" /Od /sdl /Fd"Debug\vc142.pdb" /Zc:inline /fp:precise /D "WIN32" /D "_DEBUG" /errorReport:prompt /WX- /Zc:forScope /Gd /Oy- /clr /FU"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\mscorlib.dll" /MDd /FC /Fa"Debug\" /nologo /Fo"Debug\" /Fp"Debug\UTCommFunctions.pch" /diagnostics:column 

Linker command line:

/OUT:"C:\Users\fguido\Source\Repos\SSABL2NewModels\SSABL2NewModels\Debug\UTCommFunctions.dll" /MANIFEST /NXCOMPAT /PDB:"C:\Users\fguido\Source\Repos\SSABL2NewModels\SSABL2NewModels\Debug\UTCommFunctions.pdb" /DYNAMICBASE "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /FIXED:NO /DLL /MACHINE:X86 /INCREMENTAL:NO /PGD:"C:\Users\fguido\Source\Repos\SSABL2NewModels\SSABL2NewModels\Debug\UTCommFunctions.pgd" /SUBSYSTEM:WINDOWS /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"Debug\UTCommFunctions.dll.intermediate.manifest" /ERRORREPORT:PROMPT /NOLOGO /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\UnitTest\lib" /ASSEMBLYDEBUG /TLBID:1 

I get these errors and I am stuck. I am quite new to the UT

Severity    Code    Description Project File    Line    Suppression State
Error   LNK1120 3 unresolved externals  UTCommFunctions C:\Users\fguido\Source\Repos\SSABL2NewModels\SSABL2NewModels\Debug\UTCommFunctions.dll  1   
Error   LNK2020 unresolved token (06000001) CCommMath::.ctor    UTCommFunctions C:\Users\fguido\Source\Repos\SSABL2NewModels\SSABL2NewModels\UTCommFunctions\UTCommFunctions.obj    1   
Error   LNK2020 unresolved token (06000002) CCommMath::Interpolation    UTCommFunctions C:\Users\fguido\Source\Repos\SSABL2NewModels\SSABL2NewModels\UTCommFunctions\UTCommFunctions.obj    1   
Error   LNK2020 unresolved token (06000003) CCommMath::Sum  UTCommFunctions C:\Users\fguido\Source\Repos\SSABL2NewModels\SSABL2NewModels\UTCommFunctions\UTCommFunctions.obj    1   
Alan Birtles
  • 32,622
  • 4
  • 31
  • 60
  • 1
    What is `CCommMath`? Is that your code? The class you are testing? – john Jul 17 '20 at 20:05
  • Notte: It is better to copy the text of the errors from the Output Tab of Visual Studio instead of the Errors List. – drescherjm Jul 17 '20 at 20:10
  • Thank you John. Yes it is my class and it is very simple and barely empty. I was trying to follow the example: https://learn.microsoft.com/en-us/visualstudio/test/writing-unit-tests-for-c-cpp?view=vs-2019 but I get the linker error or I got the test not running. As I told before I am new to UT in c++. – Fabio Guido Jul 17 '20 at 22:22

0 Answers0