Can't compile with Visual Studio 2022 using .lib Topic is solved

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.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7480
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Can't compile with Visual Studio 2022 using .lib

Post by ONEEYEMAN »

doublemax,
Then there would be no crashes if I link statically to the 3rd party libraries.

However, if I do and there is an installed dynamic library of such there will be crashes, especially on *nix with png/jpeg/tiff libraries. Especially if they are not API/ABI compatible.

I don't know how different linker is between MS and *nix, but we are talking the same pattern here.

And the seurity is a good enough reason to do nstatically linking. How often do you or anyone else from Development Community checks MS sites for Security updates and then rebuilds their software because the vulnerability was found and fixed?

Thank you.
User avatar
doublemax
Moderator
Moderator
Posts: 19161
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Can't compile with Visual Studio 2022 using .lib

Post by doublemax »

ONEEYEMAN wrote: Mon Aug 01, 2022 3:51 pm doublemax,
Then there would be no crashes if I link statically to the 3rd party libraries.
Inside one application you can't mix static and dynamic. But an exe with statically linked CRTs won't affect any other app.
Use the source, Luke!
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7480
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Can't compile with Visual Studio 2022 using .lib

Post by ONEEYEMAN »

doublemax,
I'm not talking bout mixing it in one application.
In the past people tried to link statically to wx, which of course brought the static linking to a png/tiff/jpeg library.
However, if the target system had a dynamic png/tiff/jpeg library which were not API/ABI compatible the software was experienced intermittent crashes.

Granted - that ws on *nix and I don't know how different *nix linker is from Windows, but the idea of statically linked somethong that could already be onm the target system and be API/ABI incompatible - worries me very much. ;-)

Thank you.
User avatar
doublemax
Moderator
Moderator
Posts: 19161
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Can't compile with Visual Studio 2022 using .lib

Post by doublemax »

I know the situation is different under Linux, but i still find that hard to believe. Sounds more like the user made a mistake and overwrote the system libs somehow.
Use the source, Luke!
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7480
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Can't compile with Visual Studio 2022 using .lib

Post by ONEEYEMAN »

doublemax,
JUst check the forum.
You will find couple of posts about that issue in the past.

I don't know if the situation improved now - I never build statically under Linux at all. ;-)

Thank you.
newguy111
In need of some credit
In need of some credit
Posts: 6
Joined: Mon Apr 27, 2020 4:24 am

Re: Can't compile with Visual Studio 2022 using .lib

Post by newguy111 »

Hi DoubleMax,

I've been having a similar problem with using static libraries. I am trying to link the CRTs statically by highlighting all the files ->right clicking ->properties, but for some reason it doesn't show me the "C++" dropdown? When I'm working in my actual project it does give me that dropdown. Do you know any workarounds for this?

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

Re: Can't compile with Visual Studio 2022 using .lib

Post by doublemax »

newguy111 wrote: Wed Aug 10, 2022 5:30 pm I've been having a similar problem with using static libraries. I am trying to link the CRTs statically by highlighting all the files ->right clicking ->properties, but for some reason it doesn't show me the "C++" dropdown? When I'm working in my actual project it does give me that dropdown. Do you know any workarounds for this?
That happens when not all items you have selected, have that property. You probably selected "_custom_build", too. Select only from "adv" to "xrc".
Use the source, Luke!
newguy111
In need of some credit
In need of some credit
Posts: 6
Joined: Mon Apr 27, 2020 4:24 am

Re: Can't compile with Visual Studio 2022 using .lib

Post by newguy111 »

You're a legend! That was exactly the problem.

Question - would you be willing to offer advice on a related issue? I'm trying to make my program compile into a standalone .exe. However, I've got another library called cpr which relies on another library called libcurl. I built cpr with vcpkg and included "-static" in the command hoping that would make everything static. However, when I moved the full project's .exe to a random directory to test, I got a message saying "libcurl.dll" was missing.

I know it's not wxWidgets related, so understand if you don't feel like helping. If you do though I'd be glad to provide any details you need.

Thanks again for the help!
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7480
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Can't compile with Visual Studio 2022 using .lib

Post by ONEEYEMAN »

Hi,
What verion of wxWidgets you are working with? What libcurl version you library depends on?

There might be a conflict between wxWidgets libcurl and cpr libcurl...
So you need to be very careful when building/testing the whole product.

Thank you.
User avatar
doublemax
Moderator
Moderator
Posts: 19161
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Can't compile with Visual Studio 2022 using .lib

Post by doublemax »

newguy111 wrote: Wed Aug 10, 2022 9:51 pm I'm trying to make my program compile into a standalone .exe. However, I've got another library called cpr which relies on another library called libcurl. I built cpr with vcpkg and included "-static" in the command hoping that would make everything static. However, when I moved the full project's .exe to a random directory to test, I got a message saying "libcurl.dll" was missing.
Which libcurl version are you using? Last time i updated my libcurl, i couldn't find any fitting prebuilt binary and ended up building libcurl from the curl sources myself (which is not too hard).
Use the source, Luke!
newguy111
In need of some credit
In need of some credit
Posts: 6
Joined: Mon Apr 27, 2020 4:24 am

Re: Can't compile with Visual Studio 2022 using .lib

Post by newguy111 »

I went into the version cpr is using and it says: 7.80.0-Dev.

For the version wxWidgets is using, do you have any ideas on how to find that? I opened up wxWidgets in File Explorer and tried searching "libcurl", also tried poking around in various folders for it, to no avail.

Thank you both for your willingness to help!
User avatar
doublemax
Moderator
Moderator
Posts: 19161
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Can't compile with Visual Studio 2022 using .lib

Post by doublemax »

newguy111 wrote: Thu Aug 11, 2022 4:31 pm For the version wxWidgets is using, do you have any ideas on how to find that? I opened up wxWidgets in File Explorer and tried searching "libcurl", also tried poking around in various folders for it, to no avail.
AFAIK wxWidgets does not include libcurl.
Use the source, Luke!
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7480
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Can't compile with Visual Studio 2022 using .lib

Post by ONEEYEMAN »

doublemax,
I believe wxWeb* classes needs cURL and it is being pulled as submodule.

Thank you.
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4204
Joined: Sun Jan 03, 2010 5:45 pm

Re: Can't compile with Visual Studio 2022 using .lib

Post by PB »

AFAIK, wxWidgets uses libCURL only on Linux (for wxWebRequest), as can be seen e.g. in CMake files.
New Pagodi
Super wx Problem Solver
Super wx Problem Solver
Posts: 469
Joined: Tue Jun 20, 2006 6:47 pm
Contact:

Re: Can't compile with Visual Studio 2022 using .lib

Post by New Pagodi »

Yes. on windows, wxWebrequest uses schannel (windows' internal TLS library). If you build with CMake, you have the option to use your own curl instead.

Unless you have a very good reason for doing so, I wouldn't do that.
Post Reply