使NetBeans的C ++解析器与Emscripten一起使用 [英] Getting NetBeans' C++ parser to work with Emscripten
问题描述
我在使用NetBeans的C ++解析器时遇到了一些问题.除了我在代码中执行 std :: vector
或 std :: cout
等时,其他所有内容似乎都正常运行.如果我忽略了 std ::
部分,则解析器可以正常工作,但是当我将其放入时,它会给出
I'm having a little problem with NetBeans' C++ parser. Everything seems to work fine except for when I do std::vector
or std::cout
etc. in my code. If I leave off the std::
part the parser works fine but when I have it in it gives
"Unable to resolve identifier vector."
(或另一个示例中的 cout
).有人知道为什么要这么做吗?
(or cout
in the other example). Anyone know why it's doing this?
其他信息:
我正在使用Netbean8.我在工具>选项> C/C ++>构建工具中具有以下设置:
I'm using Netbean 8. I have the following settings in Tools > Options > C/C++ > Build Tools:
Build Host: Localhost
Family: CLang
Encoding: UTF-8
Base Directory: C:\Program Files\Emscripten
C Compiler: C:\Program Files\Emscripten\emscripten\1.12.0\emcc
C++ Compiler: C:\Program Files\Emscripten\emscripten\1.12.0\em++
Debugger Command: C:\Program Files\Emscripten\mingw\4.6.2_32bit\gdb.exe
CMake Command: C:\Program Files\CMake 2.8\bin\cmake.exe
我在工具>选项> C/C ++>代码协助> C ++编译器>包含目录中具有以下包含路径:
I have the following include paths in Tools > Options > C/C++ > Code Assistance > C++ Compiler > Include Directories:
C:\Program Files\Emscripten\emscripten\1.12.0\system\include
C:\Program Files\Emscripten\emscripten\1.12.0\system\include\libc
C:\Program Files\Emscripten\emscripten\1.12.0\system\include\emscripten
C:\Program Files\Emscripten\emscripten\1.12.0\system\include\libcxx
我找出了问题的可能原因.似乎某些LLVM/CLang库使用定义 _LIBCPP_BEGIN_NAMESPACE_STD
和 _LIBCPP_END_NAMESPACE_STD
(包含在< __ config>
)中的定义某些库(包括< iostream>
和< vector>
)的 namespace std;
的定义,我猜测这些是从Netbeans C ++解析器中隐藏的
I figured out the likely cause of the problem. It seems that some LLVM/CLang libraries use definitions _LIBCPP_BEGIN_NAMESPACE_STD
and _LIBCPP_END_NAMESPACE_STD
(contained in <__config>
) instead of namespace std;
for some libraries including <iostream>
and <vector>
and I'm guessing those are hidden from Netbeans C++ parser.
我不确定如何解决此问题.如果发现有问题,将报告.
I'm not sure how to fix this yet. Will report back if I find something.
推荐答案
我通过添加以下条目来修复它:
I fixed it by adding the entry:
__clang__
在工具>选项> C/C ++>代码协助> C ++编译器>宏定义中.
这使 _LIBCPP_BEGIN_NAMESPACE_STD
和 _LIBCPP_END_NAMESPACE_STD
对Netbeans的解析器可见,并依次显示 vector
和 cout
位于 std
命名空间中.
This made _LIBCPP_BEGIN_NAMESPACE_STD
and _LIBCPP_END_NAMESPACE_STD
visible to Netbeans' parser and in-turn showed it that vector
and cout
were in the std
namespace.
这篇关于使NetBeans的C ++解析器与Emscripten一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!