Click here to Skip to main content
16,019,740 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Linker error Pin
leon de boer15-Sep-17 22:21
leon de boer15-Sep-17 22:21 
GeneralRe: Linker error Pin
Vaclav_16-Sep-17 3:02
Vaclav_16-Sep-17 3:02 
GeneralRe: Linker error Pin
leon de boer16-Sep-17 3:16
leon de boer16-Sep-17 3:16 
QuestionClarification of Debug/Release mode Pin
ForNow11-Sep-17 2:24
ForNow11-Sep-17 2:24 
AnswerRe: Clarification of Debug/Release mode Pin
Jochen Arndt11-Sep-17 3:21
professionalJochen Arndt11-Sep-17 3:21 
AnswerRe: Clarification of Debug/Release mode Pin
leon de boer11-Sep-17 15:51
leon de boer11-Sep-17 15:51 
GeneralRe: Clarification of Debug/Release mode Pin
ForNow11-Sep-17 15:58
ForNow11-Sep-17 15:58 
GeneralRe: Clarification of Debug/Release mode Pin
leon de boer12-Sep-17 8:33
leon 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
ForNow12-Sep-17 8:46 
GeneralRe: Clarification of Debug/Release mode Pin
leon de boer13-Sep-17 18:25
leon de boer13-Sep-17 18:25 
Questionbatch file quicksort algorithm Pin
wayne wu10-Sep-17 16:10
wayne wu10-Sep-17 16:10 
AnswerRe: batch file quicksort algorithm Pin
Richard MacCutchan10-Sep-17 19:24
mveRichard MacCutchan10-Sep-17 19:24 
AnswerRe: batch file quicksort algorithm Pin
CPallini11-Sep-17 2:22
mveCPallini11-Sep-17 2:22 
Questionelaborate the build instructions Pin
Member 125524089-Sep-17 13:05
Member 125524089-Sep-17 13:05 
AnswerRe: elaborate the build instructions Pin
Richard MacCutchan10-Sep-17 4:18
mveRichard MacCutchan10-Sep-17 4:18 
AnswerRe: elaborate the build instructions Pin
CPallini10-Sep-17 5:14
mveCPallini10-Sep-17 5:14 
QuestionHow to #include <string> in C code Pin
Vaclav_9-Sep-17 6:18
Vaclav_9-Sep-17 6:18 
AnswerRe: How to #include <string> in C code Pin
Richard MacCutchan9-Sep-17 6:39
mveRichard MacCutchan9-Sep-17 6:39 
AnswerRe: How to #include <string> in C code Pin
CPallini10-Sep-17 3:03
mveCPallini10-Sep-17 3:03 
Questiondirectx 9 ? Pin
bluatigro6-Sep-17 22:03
bluatigro6-Sep-17 22:03 
SuggestionRe: directx 9 ? Pin
Richard MacCutchan7-Sep-17 4:41
mveRichard MacCutchan7-Sep-17 4:41 
QuestionRe: directx 9 ? Pin
David Crow7-Sep-17 5:12
David Crow7-Sep-17 5:12 
AnswerRe: directx 9 ? Pin
leon de boer7-Sep-17 6:57
leon de boer7-Sep-17 6:57 
QuestionOnce Again Assert in Release and I am lost Pin
ForNow4-Sep-17 13:39
ForNow4-Sep-17 13:39 
QuestionRe: Once Again Assert in Release and I am lost Pin
David Crow4-Sep-17 15:45
David 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.