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

MS Visual Studio "/Zc:wchar_t-" compiler parameter support added #140

Closed
wants to merge 1 commit into from
Closed

Conversation

slavanap
Copy link

If /Zc:wchar_t- compiler parameter is specified, then wchar_t is defined as
typedef unsigned short wchar_t;
Thus, this leads to conflict in template definition in format.h

You can verify it in any Visual Studio project with spdlog with

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:wchar_t-")

reference: https://msdn.microsoft.com/ru-ru/library/dh8che7s.aspx

@gabime
Copy link
Owner

gabime commented Oct 25, 2015

format.h is the cppformat library. Please issue the merge there

@gabime gabime closed this Oct 25, 2015
@slavanap
Copy link
Author

Ok. Thank you for the tip.
I've already submitted it.

@slavanap
Copy link
Author

@gabime One more thing, because I don't know how to submit pull request to wiki page.
https://github.com/gabime/spdlog/wiki/1.-QuickStart

namespace fmt should be specified for custom operator<<, otherwise it doesn't compile under MSVS 2015.

class some_class {};
namespace shared {
    std::ostream& operator<<(std::ostream& os, const some_class& c) {
        return os << "some_class";
    }
}
using namespace shared; // not necessary

namespace fmt {
    using namespace shared;
}

void custom_class_example() {
    some_class c;
    auto console = spd::stdout_logger_mt("console");
    console->info("custom class with operator<<: {}..", c);
    console->info() << "custom class with operator<<: " << c << "..";
}

bachittle pushed a commit to bachittle/spdlog that referenced this pull request Dec 22, 2022
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

Successfully merging this pull request may close these issues.

2 participants