Click here to Skip to main content
13,662,923 members

C / C++ / MFC

GeneralRe: Linker error Pin
leon de boer15-Sep-17 22:21
memberleon de boer15-Sep-17 22:21 
GeneralRe: Linker error Pin
Vaclav_Sal16-Sep-17 3:02
memberVaclav_Sal16-Sep-17 3:02 
GeneralRe: Linker error Pin
leon de boer16-Sep-17 3:16
memberleon de boer16-Sep-17 3:16 
QuestionClarification of Debug/Release mode Pin
ForNow11-Sep-17 2:24
memberForNow11-Sep-17 2:24 
AnswerRe: Clarification of Debug/Release mode Pin
Jochen Arndt11-Sep-17 3:21
mvpJochen Arndt11-Sep-17 3:21 
AnswerRe: Clarification of Debug/Release mode Pin
leon de boer11-Sep-17 15:51
memberleon de boer11-Sep-17 15:51 
GeneralRe: Clarification of Debug/Release mode Pin
ForNow11-Sep-17 15:58
memberForNow11-Sep-17 15:58 
GeneralRe: Clarification of Debug/Release mode Pin
leon de boer12-Sep-17 8:33
memberleon de boer12-Sep-17 8:33 
No the VC and MFC runtime libraries. Pull up control panel and go to the installed apps and features and roll to to Microsoft Visual C++. You will have a pile of things labelled as Visual Studio VC++ xxxx redistributable. Those are the same junk you have to package up with you EXE file when you go to place it on a new machine. All they are doing is trying to reduce the footprint of the EXE file itself by sitting it on a runtime library. It's the same as what Visual Basic does with it's runtime libraries and if I wanted to use Visual Basic I would write in Visual Basic not C++. Those redistributable libraries quite often develop bugs with new versions of Windows you notice you have to install them for every windows version you have a program written for. On my machine I have so many versions ... 2005, 2 x 2008, 2010, 2 x 2012, 2013, 2015, 2017

Using the settings I gave you the you create statically linked executable it flattens the EXE to only use the physical standard windows API in static linking. It means the EXE does not need anything else you can install it on a new Windows machine that has never seen a VC++ xxxx redistributable. The cost is it can be slower to compile because what looks like a minor change may setup big changes to what it does on code to the windows API and the EXE size will be some percentage bigger. As a guide my largest CAD program I make which is close to a million lines makes an EXE just over 3MBytes so it really isn't that dramatic.

There used to be a problem with console apps where they would call out to the library but even that changed since Windows 7. The trick is you don't actually build a console app, you build a windows app and then call AllocConsole. The thing you end up with on screen looks and behaves like a console APP, but underneath they are very different. You will note the only attachment of the virtual console is kernel32.dll via kernel32.lib Smile | :)
AllocConsole function - Windows Console | Microsoft Docs[^]
To make life interesting on Windows 10 they also allow users to bring up the old legacy console with an executable.
Windows 10 Command Prompt: New Console vs. Legacy Console[^]
One of the jobs I always do on Windows 10 is throw a program error if some fiddler sets that thing as it makes things unstable.

There are two caveats
- All libraries the executable is linked to have to be compiled with the same setting. So if you are using 3rd party libraries you need to rebuild those entire libraries as well.
- Compiling shared libraries (DLL) with this static linking will sometimes throw up multiple definitions. It used to be a pain it isn't anymore because they introduced an number of linker and section controls which make it rather trivial now.
In vino veritas

modified 12-Sep-17 14:45pm.

GeneralRe: Clarification of Debug/Release mode Pin
ForNow12-Sep-17 8:46
memberForNow12-Sep-17 8:46 
GeneralRe: Clarification of Debug/Release mode Pin
leon de boer13-Sep-17 18:25
memberleon de boer13-Sep-17 18:25 
Questionbatch file quicksort algorithm Pin
wayne wu10-Sep-17 16:10
memberwayne wu10-Sep-17 16:10 
AnswerRe: batch file quicksort algorithm Pin
Richard MacCutchan10-Sep-17 19:24
protectorRichard MacCutchan10-Sep-17 19:24 
AnswerRe: batch file quicksort algorithm Pin
CPallini11-Sep-17 2:22
mvpCPallini11-Sep-17 2:22 
Questionelaborate the build instructions Pin
Member 125524089-Sep-17 13:05
memberMember 125524089-Sep-17 13:05 
AnswerRe: elaborate the build instructions Pin
Richard MacCutchan10-Sep-17 4:18
protectorRichard MacCutchan10-Sep-17 4:18 
AnswerRe: elaborate the build instructions Pin
CPallini10-Sep-17 5:14
mvpCPallini10-Sep-17 5:14 
QuestionHow to #include <string> in C code Pin
Vaclav_Sal9-Sep-17 6:18
memberVaclav_Sal9-Sep-17 6:18 
AnswerRe: How to #include <string> in C code Pin
Richard MacCutchan9-Sep-17 6:39
protectorRichard MacCutchan9-Sep-17 6:39 
AnswerRe: How to #include <string> in C code Pin
CPallini10-Sep-17 3:03
mvpCPallini10-Sep-17 3:03 
Questiondirectx 9 ? Pin
bluatigro6-Sep-17 22:03
memberbluatigro6-Sep-17 22:03 
SuggestionRe: directx 9 ? Pin
Richard MacCutchan7-Sep-17 4:41
protectorRichard MacCutchan7-Sep-17 4:41 
QuestionRe: directx 9 ? Pin
David Crow7-Sep-17 5:12
memberDavid Crow7-Sep-17 5:12 
AnswerRe: directx 9 ? Pin
leon de boer7-Sep-17 6:57
memberleon de boer7-Sep-17 6:57 
QuestionOnce Again Assert in Release and I am lost Pin
ForNow4-Sep-17 13:39
memberForNow4-Sep-17 13:39 
QuestionRe: Once Again Assert in Release and I am lost Pin
David Crow4-Sep-17 15:45
memberDavid Crow4-Sep-17 15:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Advertise | Privacy | Cookies | Terms of Service
Web01-2016 | 2.8.180810.1 | Last Updated 16 Aug 2018
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid