9

How to suppress (hide) LNK4221,4006 warning in Visual Studio 2015?

D:\solutionFolder\projectFolder\OgreHlmsPbs_d.lib(OgreHlmsPbs_d.dll) 1 __NULL_IMPORT_DESCRIPTOR already defined in OgreOverlay_d.lib(OgreOverlay_d.dll); second definition ignored LNK4006

D:\solutionFolder\projectFolder\OgreHlmsPbs_d.lib(OgreHlmsPbs_d.dll) 1 This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library LNK4221

The program run fine.

I use librarian (same as a SO question : LNK4006, LNK4221 warnings when using static library that includes another static library).

I have tried :-

  • Linker > all options > additional option = /ignore:4221,4006
  • Linker > Command Line > additional option = /ignore:4221,4006
  • Librarian > all options > additional option = /ignore:4221,4006
  • Librarian > Command Line > additional option = /ignore:4221,4006

I have set it to both user-project and the static library.

I have also tried /ignore:4221 alone for the above 4 combination, it can't suppress LINK4221.
Capital /IGNORE:4221 doesn't work either.

All of the above don't solve. Are there any other combination?

I don't want to modify my code e.g.

__declspec( dllexport ) void getRidOfLNK4221(){}    

I have read :-

I guess this version of Visual Studio (2015) may have different way to fix this issue.

Further investigation

After posting the question, I found :-

I started to think that using librarian is probably not a good idea in the first place.

However, even I don't set librarian, I still get this warning for my own empty MyClass.cpp.
Therefore, this problem is probably not related to librarian.

D:\solutionFolder\projectFolder\MyClass.obj 1 This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library LNK4221

Community
  • 1
  • 1
javaLover
  • 6,347
  • 2
  • 22
  • 67
  • Not sure if this helps: https://stackoverflow.com/questions/661606/visual-c-how-to-disable-specific-linker-warnings – JVApen Oct 23 '20 at 11:28
  • For me, adding "/ignore:4221" to Librarian additional options of the static library project worked in Visual Studio 2015 Update 3. – Detheroc Apr 25 '22 at 21:49

0 Answers0