Compiling in Visual Studio 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.
Post Reply
geen0
Earned a small fee
Earned a small fee
Posts: 10
Joined: Sat Oct 03, 2020 1:32 pm

Compiling in Visual Studio

Post by geen0 » Fri Oct 16, 2020 10:59 am

Hello i finally finished my app, everything is working fine but i can only run it in debug, when i want to compile it in "relase" i get a lot of errors.


Ofc i need to compile in relase because otherwise the other people can't run the .exe properly(they miss the debug dlls). i think im just not doing it right but really don't know where to look.

Can someone help me?
Last edited by geen0 on Fri Oct 16, 2020 4:46 pm, edited 1 time in total.

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

Re: Compiling in Visual Studio

Post by doublemax » Fri Oct 16, 2020 11:05 am

when i want to compile it in "relase" i get a lot of errors.
What errors?

Possible reasons:
- you didn't build the wxWidgets libraries in release mode
- you didn't use the same settings when building your app and the wx libraries
- wrong include and/or library paths for the release build
Use the source, Luke!

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4404
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Compiling in Visual Studio

Post by ONEEYEMAN » Fri Oct 16, 2020 4:17 pm

Hi,
On top of what doublemax mentioned:
Why do you think you can't supply the debug version of your software?

Thank you.

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

Re: Compiling in Visual Studio

Post by PB » Fri Oct 16, 2020 4:34 pm

ONEEYEMAN wrote:
Fri Oct 16, 2020 4:17 pm
Why do you think you can't supply the debug version of your software?
AFAIK, at least because:
1. You are not allowed to distribute debug version of the CRT.
2. Debug build of application can be much, much slower (e.g., some container access) than the release build.

geen0
Earned a small fee
Earned a small fee
Posts: 10
Joined: Sat Oct 03, 2020 1:32 pm

Re: Compiling in Visual Studio

Post by geen0 » Fri Oct 16, 2020 4:52 pm

doublemax wrote:
Fri Oct 16, 2020 11:05 am
when i want to compile it in "relase" i get a lot of errors.
What errors?

Possible reasons:
- you didn't build the wxWidgets libraries in release mode
- you didn't use the same settings when building your app and the wx libraries
- wrong include and/or library paths for the release build
Ok so, i get errors like that: Error LNK2038 found mismatch for 'RuntimeLibrary': value 'MDd_DynamicDebug' does not match value 'MTd_StaticDebug' in Source.obj MyApp C: \ Users \ Me \ source \ repos \ MyApp \ MyApp.lixbase (string) 1
And like that: Error LNK2001 external symbol __imp__modf not resolved

This happens when i also change the runtime library. otherwise people will not be able to use my .exe without using the debug dlls

Any further advice?

geen0
Earned a small fee
Earned a small fee
Posts: 10
Joined: Sat Oct 03, 2020 1:32 pm

Re: Compiling in Visual Studio

Post by geen0 » Fri Oct 16, 2020 5:03 pm

ONEEYEMAN wrote:
Fri Oct 16, 2020 4:17 pm
Hi,
On top of what doublemax mentioned:
Why do you think you can't supply the debug version of your software?

Thank you.
The other guy already answered, and also because it uses some dlls that i have because i got VS installed, but other people do not

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

Re: Compiling in Visual Studio

Post by doublemax » Fri Oct 16, 2020 5:30 pm

Ok so, i get errors like that: Error LNK2038 found mismatch for 'RuntimeLibrary': value 'MDd_DynamicDebug' does not match value 'MTd_StaticDebug' in Source.obj MyApp C: \ Users \ Me \ source \ repos \ MyApp \ MyApp.lixbase (string) 1
This means you're trying to link the wrong libraries (debug instead of release) to your application. On top of that they were built with the wrong CRT setting.

1) Open the wxWidgets solution file you used to build the wxWidgets libraries, e.g. wx_vc16.sln. Switch configurarion to "release". Select all projects in the solution explorer (adv, aui, base..., to xrc). Open properties, change the "Runtime library" setting to "Multithreaded (/MT)" and rebuild.

2) Open your application in VS, change configuration to release, open linker settings, make sure you're linking to the release version of the wx libraries. E.g. link "wxmsw31u_core.lib", not "wxmsw31ud_core.lib". (The additional 'd' in the filename stands for 'debug')

For completeness sake (although i don't think Microsoft cares): If you were using Visual Studio Community, the licence does not allow you to distribute a commercial application with statically linked runtimes.
Use the source, Luke!

geen0
Earned a small fee
Earned a small fee
Posts: 10
Joined: Sat Oct 03, 2020 1:32 pm

Re: Compiling in Visual Studio

Post by geen0 » Fri Oct 16, 2020 7:44 pm

doublemax wrote:
Fri Oct 16, 2020 5:30 pm
Ok so, i get errors like that: Error LNK2038 found mismatch for 'RuntimeLibrary': value 'MDd_DynamicDebug' does not match value 'MTd_StaticDebug' in Source.obj MyApp C: \ Users \ Me \ source \ repos \ MyApp \ MyApp.lixbase (string) 1
This means you're trying to link the wrong libraries (debug instead of release) to your application. On top of that they were built with the wrong CRT setting.

1) Open the wxWidgets solution file you used to build the wxWidgets libraries, e.g. wx_vc16.sln. Switch configurarion to "release". Select all projects in the solution explorer (adv, aui, base..., to xrc). Open properties, change the "Runtime library" setting to "Multithreaded (/MT)" and rebuild.

2) Open your application in VS, change configuration to release, open linker settings, make sure you're linking to the release version of the wx libraries. E.g. link "wxmsw31u_core.lib", not "wxmsw31ud_core.lib". (The additional 'd' in the filename stands for 'debug')

For completeness sake (although i don't think Microsoft cares): If you were using Visual Studio Community, the licence does not allow you to distribute a commercial application with statically linked runtimes.
This solves the question, im really thankful!

Post Reply