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.
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.