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

/usr/include/c++/9/bits/basic_string.tcc:212:32: error: ‘__N’ was not declared in this scope #2

Open
lvxiaojie111 opened this issue Jun 5, 2023 · 2 comments

Comments

@lvxiaojie111
Copy link

您好,cmake ..时没有问题,但是make 时,还是有类似下面这样的错误:
错误1:/usr/include/c++/9/bits/basic_string.tcc:212:32: error: ‘__N’ was not declared in this scope
212 | std::__throw_logic_error(__N("basic_string::"
| ~~~^~~~~~~~~~~~~~~~~
213 | "_M_construct null not valid"));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
错误2:/home/ljj/firesmoke/20230526SmartCity/web/src/cweb/router.h:73:31: required from here
/usr/include/c++/9/bits/basic_string.tcc:212:32: error: ‘__N’ was not declared in this scope
我只是列出了其中2个错误,很有很多类似的错误,但是这些错误都是在调用/usr/include/c++/9/bits/目录下出现的错误,应该怎么处理呢,期待您的回答。

@lvxiaojie111
Copy link
Author

我的环境ubuntu 20.04 gcc-9 g++-9

@Nodesheep
Copy link
Owner

我查看了g++9中命中了这段代码,但是__N宏未定义从而导致错误

// NB: Not required, but considered best practice.
  if (__gnu_cxx::__is_null_pointer(__beg) && __beg != __end)
    std::__throw_logic_error(__N("basic_string::"
               "_M_construct null not valid"));

我在gcc内置的c++目录gcc@10/10.4.0/include/c++/10.4.0/x86_64-apple-darwin22/bits下的c++config.h文件中找到了这个宏的定义

#define __N(msgid)     (msgid) 

请确认下你系统中gcc目录下是否包含c++config.h文件并且包含__N定义,若不存在可尝试手动定义该宏。

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