Skip to content
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::cerr confusion #461

Open
n3rdx opened this issue Dec 9, 2020 · 0 comments
Open

std::cerr confusion #461

n3rdx opened this issue Dec 9, 2020 · 0 comments

Comments

@n3rdx
Copy link

n3rdx commented Dec 9, 2020

Hi, I am learning Nanogui use. I made a local version of Example #1, as example11.cpp with calls to SQLite3 (in development) and can easily compile the code without modifications on Win10 and Linux 64 bit, and run the executable in a graphical environment. What I would like to learn is why does MS Visual Studio 2019 complain as shown below, when I review the code block (in x64-Debug mode, and in Linux-GCC-Debug mode), where it says concerning several invocations of "std::cerr", or stderr - yet the program compiles in both environments with vcpkg + Cmake and runs well. So, is this fully normal, or do we need to have a #ifdef ... #endif block to define a gnu-C++ specific c++ function call?

namespace "std" has no member "cerr"

and this is related to the code snippet:

} catch (const std::exception &e) {
        std::string error_msg = std::string("Caught a fatal error: ") + std::string(e.what());
        #if defined(_WIN32)
            MessageBoxA(nullptr, error_msg.c_str(), NULL, MB_ICONERROR | MB_OK);
        #else
            std::cerr << error_msg << std::endl;
        #endif
        return -1;
    } catch (...) {
        std::cerr << "Caught an unknown error!" << std::endl;
    }

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant