Multiple linker warnings when compiling Native Unit Test

  • Thread starter Thread starter Morales1235
  • Start date Start date
M

Morales1235

Guest
Hello,

I use VS2012 and Native Unit Test Framework. The compilation is successful (test cases also) but it generates warnings. I encountered those warning in the web, but neither of the provided solutions work in my case.

LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/FORCE' specification
1>LastCompiledTestFileName.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:LBR' specification
1>mfcs110d.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in msvcrtd.lib(dllmain.obj); second definition ignored

When I change ZI to Zi option:

warning LNK4075: ignoring '/INCREMENTAL' due to '/FORCE' specification
1>MyOtherLib.lib(OtherObjectInThatLib.obj) : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:LBR' specification
1>mfcs110d.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in msvcrtd.lib(dllmain.obj); second definition ignored
Creating library - means Unit Test project...
1>C:\Path\to\test\test.dll : warning LNK4088: image being generated due to /FORCE option; image may not run


I will check if I really need the "edit and continue" feature in other libs, but there is a lot of dependencies and every lib has that option turned on. But there are still other warnings.
When I change /FORCE:MULTIPLE options to UNRESOLVED it gives error LINK2005, but I could not get rid of that. Solution says to add:

extern "C" { int _afxForceUSRDLL; }

to the cpp file where DllMain is defined. How can I know where DllMain is defined in those tests?.

When I change optimizations (are empty by default) to: /OPT:NOREF and /OPT:NOICF warnings are the same.
When I set /INCREMENTAL:NO the warning LINK4075 disappear.

looking at LINK4006 - mfcs110d.lib is for MFC (which I need) and the msvcrtd.lib is for /MDd option which I cannot change (or should I change n every lib project?)

Test project depends on other static library.

Why those errors shows up and what can I do to clean that? Thanks a lot!
(probably in a few month we will switch to VS2017, maybe something will change?)


Continue reading...
 
Back
Top