Getting NetBeans' C++ parser to work with Emscripten

人盡茶涼 提交于 2019-12-13 04:20:20

问题


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."

(or cout in the other example). Anyone know why it's doing this?

Additional Info:

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

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

Edit:

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.


回答1:


I fixed it by adding the entry:

__clang__

in Tools > Options > C/C++ > Code Assistance > C++ Compiler > Macro Definitions.

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.



来源:https://stackoverflow.com/questions/24834330/getting-netbeans-c-parser-to-work-with-emscripten

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!