Visual C++ Console application fails to output to cout or with printf

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Background: I was creating sample program to statically link and call a static library (OpenSSL), and I followed a lot of instructions found online for solution and project properties to eliminate compile and link errors. (Visual Studio/C++ 2012 fully updated)

Finally, got a clean link. No warnings, no errors; but NO output to the console. (Also cin.get() seems to be skipped -- there is no pause.)

None of my attempts to print show any output (I am not talking about disappearing output due to window closing.) Even from an open command prompt, program prints nothing with either cout <<; cerr <<; or printf.

I definitely have SubSystem set to "Console":

Project->..properties->Linker->System->SubSystem set to

Console (/SUBSYSTEM:CONSOLE)

Properties show this as the full Command Line:
/OUT:"d:devCertChkDebugCertChk.exe" /MANIFEST /NXCOMPAT
/PDB:"d:devCertChkDebugCertChk.pdb" /DYNAMICBASE
"C:devOpenSsllibssleay32.lib"
"C:devOpenSslliblibeay32.lib" "Ws2_32.lib" "kernel32.lib"
"user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib"
"advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib"
"uuid.lib" "odbc32.lib" "odbccp32.lib" /DEBUG /MACHINE:X86
/INCREMENTAL /PGD:"d:devCertChkDebugCertChk.pgd"
/SUBSYSTEM:CONSOLE /MANIFESTUAC:"level=asInvoker
uiAccess=false"
/ManifestFile:"DebugCertChk.exe.intermediate.manifest"
/ERRORREPORT:PROMPT /NOLOGO /TLBID:1
I have simplified the sample program to "Hello World", done Build->Clean Solution and Rebuild Solution:#include "stdafx.h"
#include <iostream>
using namespace std;

int main()
{
cout <<"Hello Worldn";
cin.get();
}

No output at open cmd console. No output NOR even console Windows when running from within Visual Studion with debug.
Debugger definitely steps to the "cout" statement, but since there is not even a console window (not even one hidden behind) my suspicion is that somehow the console is not properly allocated or hooked up.
I have created many VC++ and VC# console applications from scratch using the wizard templates so obviously I have likely messed up something somewhere in the libraries or in the properties but in a way that allows a clean compile and link.
Any ideas?
(In the meantime, I am going to attempt to explicitly allocate the console from sample code I found.)
Thanks,
--
HerbM

View the full article
 
Back
Top