LNK4221 Warning VC++ v15.9.3 wx_vc15.sln 64-bit debug build only

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
rando
Earned a small fee
Earned a small fee
Posts: 24
Joined: Fri Nov 09, 2018 9:11 pm

LNK4221 Warning VC++ v15.9.3 wx_vc15.sln 64-bit debug build only

Post by rando » Fri Dec 07, 2018 2:02 pm

I am running Win10 Pro, all updates applied. I downloaded wxWidgets-3.1.1.7z from the git repo.

I do not get this warning when compiling static release, only static debug. I have tried building release first, then debug (my normal workflow), building debug first then release (after clean solution command), and even fresh library install then build debug first. All results the same.

I guessed that this had something to do with the VC++ sln compilation order or precompiled header settings but I did not find any meaningful differences between the debug and release settings. That being said, the sln file is somewhat cryptic and I could easily have missed something. I am currently learning how to use this microsoft ide/toolchain.

I usually use TDM64-GCC with the makefiles, which compiles the library without this warning in both debug and release on the same workstation as the VC++ install. I am using VC++ because a couple of libraries I need to compile/link only have VC++ build setups.

setup.h changes:

Code: Select all

All WXWIN_COMPATIBILITY* 0
wxUSE_STL 1
Here is the relevant part of the build log, let me know if you want the whole thing (995 lines). The only other warnings are about type conversions which I always see when compiling wx.

Code: Select all

printps.obj : warning LNK4221: 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
headerctrlg.obj : warning LNK4221: 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
dcpsg.obj : warning LNK4221: 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
combog.obj : warning LNK4221: 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
buttonbar.obj : warning LNK4221: 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
metafile.obj : warning LNK4221: 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
iniconf.obj : warning LNK4221: 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
gdiobj.obj : warning LNK4221: 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
data.obj : warning LNK4221: 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
imagiff.obj : warning LNK4221: 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
imagfill.obj : warning LNK4221: 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
fontutilcmn.obj : warning LNK4221: 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
effects.obj : warning LNK4221: 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
cairo.obj : warning LNK4221: 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
accesscmn.obj : warning LNK4221: 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
wx_core.vcxproj -> C:\Users\auser\DEV_Libraries\wxWidgets\wxWidgets-3.1.1\build\msw\..\..\lib\vc_x64_lib\wxmsw31ud_core.lib

rando
Earned a small fee
Earned a small fee
Posts: 24
Joined: Fri Nov 09, 2018 9:11 pm

Re: LNK4221 Warning VC++ v15.9.3 wx_vc15.sln 64-bit debug build only

Post by rando » Tue Dec 11, 2018 11:18 am

Does anyone have any ideas on this problem?

User avatar
doublemax
Moderator
Moderator
Posts: 13179
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: LNK4221 Warning VC++ v15.9.3 wx_vc15.sln 64-bit debug build only

Post by doublemax » Tue Dec 11, 2018 3:49 pm

I tested with VS 15.4.1 and your setup.h changes and didn't get any of these warnings.

What happens if you just ignore the warnings? Any "real" issues?
Use the source, Luke!

rando
Earned a small fee
Earned a small fee
Posts: 24
Joined: Fri Nov 09, 2018 9:11 pm

Re: LNK4221 Warning VC++ v15.9.3 wx_vc15.sln 64-bit debug build only

Post by rando » Wed Dec 12, 2018 8:39 pm

So far I do not see any problems when ignoring the warnings but the project I am working on only contains GUI setup code so far.

rando
Earned a small fee
Earned a small fee
Posts: 24
Joined: Fri Nov 09, 2018 9:11 pm

Re: LNK4221 Warning VC++ v15.9.3 wx_vc15.sln 64-bit debug build only

Post by rando » Thu Dec 13, 2018 8:55 pm

With a more complete project (still only GUI setup code but using many more and different widgets now) I get many many LNK2001 unresolved external symbol.

I do not have time to spend on this problem. If it was gcc I could figure it out but MSBuild is very different. I solved the problem by using vcpkg to install/compile wxWidgets 3.1.1. All worked flawlessly and I can compile my project in debug or release with no errors.

C++ Library Manager for Windows, Linux, and MacOS

PB
Part Of The Furniture
Part Of The Furniture
Posts: 1882
Joined: Sun Jan 03, 2010 5:45 pm

Re: LNK4221 Warning VC++ v15.9.3 wx_vc15.sln 64-bit debug build only

Post by PB » Fri Dec 14, 2018 8:42 am

rando wrote:With a more complete project (still only GUI setup code but using many more and different widgets now) I get many many LNK2001 unresolved external symbol.
I would say this is unrelated to the harmless warnings from the original post and most likely means that you did not add a required library to the linker settings.

People using MSVC should include the MSVC-specific setup.h and then all the necessary libraries will be linked automatically, as described in the documentation. Or, if recent wxWidgets are used, there is a wxWidgets MSVS property sheet for adding wxWidgets to one's project.

rando
Earned a small fee
Earned a small fee
Posts: 24
Joined: Fri Nov 09, 2018 9:11 pm

Re: LNK4221 Warning VC++ v15.9.3 wx_vc15.sln 64-bit debug build only

Post by rando » Fri Dec 14, 2018 1:44 pm

I decided to get things working as close to possible to my normal wxWidgets workflow. The vcpkg worked, but required changing some paths and the install did not include examples.

I downloaded and compiled 3.1.2 using the vc15 sln file. I now get the LNK4221 in both debug and release builds which is at least consistent :)
I'm guessing they may be related to the advanced integration into core.

I followed this blog post, using the MSVC project property manager to import the wxWidgets.props file and also switching visual studio from mbcs to unicode (as in my comment on the blog post).

My application compiles without any errors or warnings now.

Thank you doublemax and PB for looking into this and making me aware of the props files. I did not mark as resolved because the warnings are still there.

Post Reply