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

编译错误 #1

Open
LJHolyGround opened this issue May 4, 2023 · 4 comments
Open

编译错误 #1

LJHolyGround opened this issue May 4, 2023 · 4 comments

Comments

@LJHolyGround
Copy link

LJHolyGround commented May 4, 2023

In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/optional:154:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/functional:500:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__functional/function.h:18:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__memory/allocator_traits.h:298:9: error: no matching function for call to 'construct_at'
        _VSTD::construct_at(__p, _VSTD::forward<_Args>(__args)...);
        ^~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__config:858:15: note: expanded from macro '_VSTD'
#define _VSTD std::_LIBCPP_ABI_NAMESPACE
              ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/vector:948:21: note: in instantiation of function template specialization 'std::allocator_traits<std::allocator<lexer::token_t>>::construct<lexer::token_t, lexer::symbol_t &, annotation_t, void, void>' requested here
    __alloc_traits::construct(this->__alloc(), _VSTD::__to_address(__tx.__pos_),
                    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/vector:1706:9: note: in instantiation of function template specialization 'std::vector<lexer::token_t>::__construct_one_at_end<lexer::symbol_t &, annotation_t>' requested here
        __construct_one_at_end(_VSTD::forward<_Args>(__args)...);
        ^
/Users/ljh/Study/senior2/complier-prac/PLOcompiler_C/pl0-jit/src/lexer.cpp:28:24: note: in instantiation of function template specialization 'std::vector<lexer::token_t>::emplace_back<lexer::symbol_t &, annotation_t>' requested here
                tokens.emplace_back(sym, annotation_t{.source = csr.source(), .start = csr.from_begin(), .length = n});
                       ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/usr/include/c++/v1/__memory/construct_at.h:35:16: note: candidate template ignored: substitution failure [with _Tp = lexer::token_t, _Args = <lexer::symbol_t &, annotation_t>]: no matching constructor for initialization of 'lexer::token_t'
constexpr _Tp* construct_at(_Tp* __location, _Args&& ...__args) {
               ^
2 warnings and 1 error generated.

请问一下可能是什么问题?

(edit) put error messages in code block

@mo-xiaoming
Copy link
Owner

never tried it on mac osx, and I cannot figure anything out from the error messages you pasted
I'll try to reproduce it on my old mac, and get back to you

but meanwhile, are you sure you're on the main branch? Because I find the location lexer.cpp:28:24 is questionable, that line should be on line 30 https://github.com/mo-xiaoming/pl0-jit/blob/main/src/lexer.cpp#L30

@LJHolyGround
Copy link
Author

thank you for your help and that's because I reformatted that file

@mo-xiaoming
Copy link
Owner

may I ask which Apple Clang version that you were using?

It took me quite a while to set up a C++ dev env on my 11 years old macbook pro, but it only support Apple Clang 11, which doesn't even support C++ 17 well. I got lots of unrelated errors, so this didn't help

Then I tried Linux Clang-14, it compiled with flying colors, so this didn't help neither...

@LJHolyGround
Copy link
Author

I use homebrew Clang with a version of 16.0.2. By the way, I find an another reopistory in GitHub, but still thank you for your considerable help.

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

2 participants