-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
std::cout doesn't print anything in console #35
Comments
I haven't heard of others having issues with using std::cout. I personally use it all the time without problems. Is this just vsgqtviewer or do non Qt VSG examples like vsgviewer from vsgExamples do this on your system as well? What OS. VSG and Qt versions are you using? |
Sorry, I didn't give enough information: |
I'll have been running vsgQt based application under WIndows 11 for the last couple of months without issues so I don't think there is a general problem. I will test writing to the console to see what happens. What hardware are you using? Have you tried standard vsgExamples like vsgviewer? Could you run the examples with the -d option to enable the Vulkan Validation Layer to see if you system is producing errors. |
vsgviewer in vsgExamples works as expected, It prints |
I have tried things out on Windows 11 and find the same problem - std::cout and any vsg::info() etc. calls are eaten by Qt. I searched on the web and came across lots of others having this problem. I can only presume that Qt is overriding the standard library's console output. Fixing Qt issues really isn't the responsibility of VSG/vsgQt so I'll have to recommend you go research what Qt is doing directly with the Qt community. As an aside, I recently had to implement a redirect of std::cout/std::cerr in the vsg::Logger but applications have to explicitly call vsg::Loggerin::instance()->redirect_std(); This was merged with this VSG PR: Potentially you could write a custom vsg::Logger to redirect it's output to Qt logging or other logging capabilities. The later is what a client does on a Windows/Qt/VSG application. The vsg::Logger::redirect_std() was required to capture the Vulkan API Layer that only writes to std::cout. I am closing this Issue as it's a Qt issue and needs to be taken up with the Qt community. |
Ok, thank you very much for your time and testing! |
Just solved my problem, I post here for future references: In Visual Studio, I changed the properties of the project. |
I presume Qt or it's CMake support is setting this, it's not something I've set previously, but then I'm 99% unix based so have to defer to Windows dev for guidance on how best to work it's idiosyncrasies. |
I am starting one of the examples, vsgtviewer from the console, for testing purposes I added
std::cout << "test" << std::endl;
in the first line of the main function. But it doesn't print anything. Even if I don't give any model as parameter it doesn't show the errorstd::cout << "Please specify a 3d model or image file on the command line."
at line 108.How can I print something in the console?
The text was updated successfully, but these errors were encountered: