I have been doing a lot of cleaning up on the Derydoca Engine project lately. One of the goals was to get rid of any and all errors and warnings in the project. I was originally playing a bit fast and loose in getting the project set up, but now I want to tighten things down so I can be sure I don’t let a little warning bubble out into a big error or bug down the road. I was able to get rid of everything except one little annoying warning:

LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification

 

Now this linker error isn’t breaking the engine in any way. I still have my three squirrels happily rotating around each other when I run the project. However, I don’t want to stare at this yellow warning every time I compile, or even worse, turn off warnings altogether and miss something more important down the line.

The confusing thing here is that I could not find these flags in my configuration of my project. After some digging, I found that by adding “/VERBOSE:LIB” to the command line options under the project’s properties (Configuration Properties -> Linker -> Command Line), the output window will give you more information on why this is happening.

After setting this and running a build, a quick look at the start of my build output revealed what is happening…

1>------ Build started: Project: DerydocaEngine, Configuration: Debug x64 ------
1>
1>Searching libraries
1> Searching C:\Users\derrickc\Documents\GitHub\derydocaengine\libs\x64\Debug\assimp.lib:
1> Searching C:\Users\derrickc\Documents\GitHub\derydocaengine\libs\x64\Debug\glew32.lib:
1> Searching C:\Users\derrickc\Documents\GitHub\derydocaengine\libs\x64\Debug\libyaml-cppmdd.lib:
1> Searching C:\Users\derrickc\Documents\GitHub\derydocaengine\libs\x64\Debug\SDL2.lib:
1> Searching C:\Users\derrickc\Documents\GitHub\derydocaengine\libs\x64\Debug\SOIL.lib:
1>SOIL.lib(SOIL.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
1>LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG' specification

 

AHA! Our friend SOIL is dirtying up my warning list! Sorry for the bad pun. But taking a look at this it tells us that SOIL is compiled with the flag /GL which is forcing the engine to compile with /LTCG which then immediately conflicts with the /INCREMENTAL flag. SOIL is open source so this is no big deal!

After opening the Visual Studio solution file for SOIL supplied in the source files, I opened up the project’s properties and navigated to Configuration Properties -> C/C++ -> Optimization and switched “Whole Program Optimization” to “No” Which turns off the /GL flag. After a recompile and replacing the respective lib objects in the Derydoca Engine project, that annoying warning has vanished!

Take a look at my error list! So clean!

So if you come across linker error LNK4075, make sure to compile your code with the /VERBOSE:LIB flag and read the output. It should direct you to what needs to be fixed.