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

compiling with clang using VC on windows do not work, std namespace issue #645

Open
perghosh opened this issue May 28, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@perghosh
Copy link

perghosh commented May 28, 2023

In windows using Visual Studio clang compiler I get errors for stl code (within the namespace std). The cl compiler that is default in visual studio works but not clang.
Clang can compile in in linux. I think that there is some issue where a header do some specific conditional compilation for windows and maybe have set how to do it based on compiler. It could be that this isn't tested because most use cl compiler in windows?

Sample code from crow, errors are in comments on each line and this is the file ci_map.h.

#pragma once

#include <boost/algorithm/string/predicate.hpp>
#include <boost/functional/hash.hpp>
#include <unordered_map>

namespace crow
{
    /// Hashing function for ci_map (unordered_multimap).
    struct ci_hash
    {
        size_t operator()(const std::string& key) const // error = error : no type named 'string' in namespace 'crow::std'; did you mean '::std::string'?
        {
            std::size_t seed = 0; // error = no type named 'size_t' in namespace 'crow::std'; did you mean simply 'size_t'?
            std::locale locale; // error = no type named 'locale' in namespace 'crow::std'; did you mean '::std::locale'?

            for (auto c : key)
            {
                boost::hash_combine(seed, std::toupper(c, locale)); // error = no member named 'toupper' in namespace 'crow::std'
            }

            return seed;
        }
    };

    /// Equals function for ci_map (unordered_multimap).
    struct ci_key_eq
    {
        bool operator()(const std::string& l, const std::string& r) const // error = no type named 'string' in namespace 'crow::std'; did you mean '::std::string'?
        {
            return boost::iequals(l, r);
        }
    };

    using ci_map = std::unordered_multimap<std::string, std::string, ci_hash, ci_key_eq>; // error = no template named 'unordered_multimap' in namespace 'crow::std'; did you mean '::std::unordered_multimap'?
} // namespace crow
@The-EDev The-EDev added the bug Something isn't working label May 30, 2023
@perghosh
Copy link
Author

Is there anyone else that have tried to compile crow in visual studio using clang in windows and got it to work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants