Dependence of a visual studio project on another project. LINKING crash

I have a solution with two projects cira_lib and md5_test. One project (cira_lib) is a central library that compiles into a DLL. Another project (md5_test) is exe with cira_lib dependency. When I create md5_test, it first creates cira_lib, so I know that the project dependencies are running. However, when VC ++ connects to md5_test, it returns with a linker error:

1> win32_cira.vcxproj -> C:\Users\ale-xps\Documents\Visual Studio 2010\Projects\win32_cira\Release\cira_lib.dll 2>------ Rebuild All started: Project: md5_test, Configuration: Release Win32 ------ 2> MD5Test.cpp 2>MD5Test.obj : error LNK2001: unresolved external symbol "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl getTimeChkSum(void)" ( ?getTimeChkSum@ @ YA?AV?$basic_string@DU ?$char_traits@D @ std@ @ V?$allocator@D @ 2@ @ std@ @XZ) 2>C:\Users\ale-xps\Documents\Visual Studio 2010\Projects\win32_cira\Release\md5_test.exe : fatal error LNK1120: 1 unresolved externals 

The "Unresolved External Character" that you see is a function in one of the class files "Utils.cpp" in the cira_lib project. So, it seems to me that Visual Studio needs me to follow some additional steps to see Object files from cira_lib? I thought that by making โ€œaddictionโ€ everything that would automatically take care of me?

I want md5_test to dynamically bind to cira_lib ... but I think Microsoft requires you to at least link to the stub.LIB file during the link, even if you "Perform dynamic linking, right?

So do I need to add the cira_lib Release directory to md5_test "Library Directories" and add cira_lib.lib to the md5_test "Linker Entry"?

The header file that I export is as follows

  __declspec( dllexport ) string getTimeChkSum( ); 

and implementation file

 __declspec(dllexport) string getTimeChkSum( ) {...} 

Even after adding these directives and restoring everything, my exe project still cannot see these characters.

+4
source share
1 answer

For executable files associated with your DLL, only those characters that you specifically mark for export are available.

You should check the MSDN documentation.

+2
source

All Articles