Basically, I want to get rid off all the LNK warning
For ex, LNK4099, or LNK4204, or any other one. I am linking my debug lib with a third party release lib. That's why I am getting those. Is there some kind of "pragma" for the linking step to hide warnings ?
There was the undocumented
#pragma comment(linker, "/ignore:4099")
but it does not work anymore on Visual Studio 7.1. I is annoying to look at hundreds of these warnings rolling down on my screen.
If I add /ignore:4099 to the "additional options" of project properties->linker->command line,
I still get the warnings LNK4099
I am using:
Microsoft Visual C++ .NET
MS Development Environment 2003 Version 7.1.3038
MS .Net Framework 1.1 Version 1.1.4322 SP1
Sorry for the trouble. Thanks
I don't have 2003 installed anymore, and I can't reproduce the problem under 2005 (i.e. /ignore:4099 works). Try this reproduction on your machine:
Get LNK4099 to manifest:
1. Create new Win32 console project.
2. Project Properties->C/C++->Code Generation->Runtime Library = Multi-threaded (/MT).
3. Tools->Command Prompt
4. Assuming you're here: C:\Program Files\Microsoft Visual Studio 8\vc\bin, do cd ..\lib
5. move libcmt.pdb libcmt.pd_
6. Back in Visual Studio, do a project rebuild.
LNK4099 should occur multiple times.
7. Add /ignore:4099 to linker settings
LNK4099 should go away. If it doesn't it could be a VS2003 bug, and it's safe to say that this wouldn't meet the bar for a future SP fix. If it does go away with VS2003, there's something else going on here. (Try doing these repro steps on your own project, remembering to undo step 2.)
Remember to undo the result of step 5 by renaming in the opposite direction!
1. Create new Win32 console project. (Debug project)
2. Project Properties->C/C++->Code Generation->Runtime Library = Multi-threaded (/MTd).
I linked with my release third party library, and this time I get:
LNK4204 occuring 293 times
I added Add /ignore:4204 to linker settings. I rebuilt. I am still getting my 293 warnings.
I f I understand correctly, your step (5. move libcmt.pdb libcmt.pd_), is just to have more warnings showing up, isn't it ? It is not a necessary step per say ?
The purpose of my reproduction (which you didn't follow exactly since you used /MTd instead of /MT) is to determine if the ability to ignore warning LNK4099 can be controlled under VS2003 in general, and with your project in particular. LNK4204 is a different matter altogether.
OK, I did exactly what you said, and adding /ignore:4099 to the additional options of the linker command line does not change anything. I still get:
LIBCMT.lib(_ctype.obj) : warning LNK4099: PDB 'libcmt.pdb' was not found with 'c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\lib\LIBCMT.lib' or at 'c:\workspace\ltuCore\ltuCoreWinLib\vc71\ttt2\Debug\libcmt.pdb'; linking object as if no debug info
If the LNK4099 still shows up under my original repro steps using VC7.1, then it might be a bug. If it goes away under my original repro steps, then there's something else going on... other libraries causing the /ignore to be ignored? I'm at a loss here. Sorry!
Have you tried troubleshooting LNK4024 by normal means, using the MSDN documentation for that warning?
the LNK4099 still shows up under your original repro steps using VC7.1.
It seems my last option (besides switching to Studio 8.0) is to try to correct all the LNK warnings I have. I know why I get these warnings, I am linking with different third party liraries. It is not affecting the execution of my process, that's why I would have prefer to just ignore it, and not spend time fixing it. Thank you for your help anyway, I have an exact diagnostic of the problem now...
I've got VS.NET 2005 and the /ignore:4099 does not work. I believe the reason is that LNK4099 is simply an unignorable linker warning... http://members.ozemail.com.au/~geoffch/samples/programming/msvc/link/link/options/ignore.htm
The lnk4099 errors you get for 3rd party debug builds that lack .pdb files are quite annoying. And as most have pointed out, there's no way to filter those redundant link warnings. This has a more serious result in that most developers completely ignore every warning message that the linker produce even those they shouldn't. Part of human nature I suppose.
To solve this problem for our developers I just wrote a short c++ linkfilter program and pipe all stdout output from link through this program. Oh the joy and ease of command line based builds.
I don't really know what you can do with the linker command line options in the project property pages or if the IDE will allow you to redirect output from the build tools but this is a fairly easy way to reduce the linker warning spam.
I seem to remember a stl error message filter tool from a few years back that would work with IDE compilations so this should be possible. But I've never built anything more complicated then hello world level applications inside the IDE so I don't know.