0

I have a (large) wxWidgets project, that compiles smoothly also in higher optimisation levels.

Now I enabled Whole Program Optimisation (/GL) for building objects and Link Time Code Generation (/LTCG) in settings of this project. This leads to an unresolved external reference - a function of external wxWidgets libraries I link agains no longer can be found.

So is this a known bug in LTO of Visual Studio? Any ideas how to workaround it or what could cause this?

Thanks!

Elmi
  • 5,899
  • 15
  • 72
  • 143
  • Are you sure you enabled the option in the same! configuration where the paths to the librar(y/ies) are setup correctly? – HelloWorld Oct 05 '15 at 08:52
  • HelloWorld: yes, I'm sure because I did not switch over to a different configuration but changed these two options in my current one. – Elmi Oct 05 '15 at 10:09
  • Optimisations can sometimes work in such a way that even projects that shouldn't link do successfully link. This is because such optimisations can sometimes prove a function is not called and therefore not need to pull in the library its referenced in and then later on if _that_ library which wasn't referenced had unresolved references you wouldn't get the issue. Changing optimisation levels obviously cna change this and so you can get unresolved references. Even though you've effectively increased optimisation level with LTO it may be that the said functions aren't getting pruned any more. – Mike Vine Oct 05 '15 at 10:28
  • Basically go and check if the unresolved reference is truly needed (it probably is, its likely your setup is wrong rather than LTO being broken) and when you've fixed it put it down to being lucky it did originally link rather than broken that it didn't subsequently link – Mike Vine Oct 05 '15 at 10:29

0 Answers0