符号 'vector' 无法解析 // 无法找到 $PATH
Symbol 'vector' could not be resolved // Unable to find $PATH
使用 Eclipse Kepler,版本:4.3.1
CDT版本:8.3.0
PTP 版本:7.0.5
在 Fedora 19 上
内核 3.14.27-100.fc19.x86_64
x86_64GNU/Linux
来自源文件-
#include "RegisterSet.h"
using namespace std;
RegisterSet::RegisterSet () {
std::vector<long> defReg ();
}
来自头文件-
#ifndef REGISTERSET_H_
#define REGISTERSET_H_
#include <iostream>
#include <vector>
namespace std {
class RegisterSet {
public:
RegisterSet();
virtual ~RegisterSet();
std::vector<long> defReg ();
};
} /* namespace std */
#endif /* REGISTERSET_H_ */
我能够使用 vi 和 g++ 进行编译。
使用 Eclipse 时出现问题。我试过设置 -
Project > Properties > C/C++ Build > Settings > GCC C++ Compiler > All options > " -std=c++0x"
GCC C++ Compiler > Dialect > language standard > C++11
GCC C++ Compiler > Includes > Include paths > /usr/include/c++/4.8.3/x86_64-redhat-linux
GCC C++ Compiler > Miscellaneous > Other flags > appended "-std=c++0x"
Current Tool Chain is Linux GCC
C/C++ General > Paths and Symbols > Includes for both GNU C and GNU C++ show /usr/include/c++/4.8.3/x86_64-redhat-linux
> Library Paths now shows /usr/lib64/ccache/
在 XL C/C++ 语言选项下,选中允许向量类型声明。
Under C/C++ Build > XL C/C++ Compiler
I get "Compiler path does not exist on the local machine"
Compile Root Path is -
/usr/lib64/ccache/g++
Compiler version v8.0
看起来我也遇到了以下错误,我假设与上面的编译器路径问题有关 -
Unable to get $PATH.
Unable to find full path for "gcc"
Unable to get $PATH.
Unable to find full path for "g++"
这是路径 -
$ which gcc
/usr/lib64/ccache/gcc
$ which g++
/usr/lib64/ccache/g++
$ which make
/usr/bin/make
/usr/lib64/ccache 和 /usr/bin 都在路径中。
$ echo $PATH
/usr/local/rvm/gems/ruby-2.0.0-p451@global/bin:/usr/local/rvm/rubies/ruby-2.0.0-p451/bin:/usr/lib64/qt-3.3/bin:/usr/lib64/ccache:/usr/libexec/lightdm:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/usr/java/jdk1.7.0_40/bin/:.:/usr/local/rvm/bin:/home/<>/.local/bin:/home/<>/bin:/usr/java/jdk1.7.0_40/bin/:.
更新:
将 - /usr/lib64/ccache 添加到 XL C/C++ Compiler > Compiler Root Path,解决 "Compiler path does not exist on the local machine."
但仍然得到 -
Unable to get $PATH.
Unable to find full path for "gcc"
和-
Semantic Error:
Symbol 'vector' could not be resolved
所以 Eclipse 似乎没有正确找到 $PATH。
关于下一步的想法?
谢谢
这有效 -
- 编辑项目的环境设置(Properties/C/C++ Build / Environment)。如果 PATH 变量没有出现在这里或没有粗体打印,则取消该对话框并在 Window / Preferences / C/C++ Build / Environment).
中编辑它们
- 确保您的 PATH 变量设置包含字符串“:${PATH}”。它周围一定有花括号!如果该变量已经存在并且无论如何都没有解析,那么从您的操作系统获取它的值并将 ${PATH} 替换为该值。
在这里找到 -
https://www.eclipse.org/forums/index.php/t/442732/
最初来自这里 -
http://wiki.gimp.org/wiki/Hacking:Problems_and_solutions#Basic_tools_not_found_although_there
控制台错误消失,g++ 和 make 被 eclipse 发现,二进制文件编译。
Vector 现在也解析了。
OT:我继续从 class 头文件中删除了对命名空间 std 的引用。它现在只存在于 .cpp 文件中。
使用 Eclipse Kepler,版本:4.3.1
CDT版本:8.3.0
PTP 版本:7.0.5
在 Fedora 19 上 内核 3.14.27-100.fc19.x86_64 x86_64GNU/Linux
来自源文件-
#include "RegisterSet.h"
using namespace std;
RegisterSet::RegisterSet () {
std::vector<long> defReg ();
}
来自头文件-
#ifndef REGISTERSET_H_
#define REGISTERSET_H_
#include <iostream>
#include <vector>
namespace std {
class RegisterSet {
public:
RegisterSet();
virtual ~RegisterSet();
std::vector<long> defReg ();
};
} /* namespace std */
#endif /* REGISTERSET_H_ */
我能够使用 vi 和 g++ 进行编译。
使用 Eclipse 时出现问题。我试过设置 -
Project > Properties > C/C++ Build > Settings > GCC C++ Compiler > All options > " -std=c++0x"
GCC C++ Compiler > Dialect > language standard > C++11
GCC C++ Compiler > Includes > Include paths > /usr/include/c++/4.8.3/x86_64-redhat-linux
GCC C++ Compiler > Miscellaneous > Other flags > appended "-std=c++0x"
Current Tool Chain is Linux GCC
C/C++ General > Paths and Symbols > Includes for both GNU C and GNU C++ show /usr/include/c++/4.8.3/x86_64-redhat-linux
> Library Paths now shows /usr/lib64/ccache/
在 XL C/C++ 语言选项下,选中允许向量类型声明。
Under C/C++ Build > XL C/C++ Compiler
I get "Compiler path does not exist on the local machine"
Compile Root Path is -
/usr/lib64/ccache/g++
Compiler version v8.0
看起来我也遇到了以下错误,我假设与上面的编译器路径问题有关 -
Unable to get $PATH.
Unable to find full path for "gcc"
Unable to get $PATH.
Unable to find full path for "g++"
这是路径 -
$ which gcc
/usr/lib64/ccache/gcc
$ which g++
/usr/lib64/ccache/g++
$ which make
/usr/bin/make
/usr/lib64/ccache 和 /usr/bin 都在路径中。
$ echo $PATH
/usr/local/rvm/gems/ruby-2.0.0-p451@global/bin:/usr/local/rvm/rubies/ruby-2.0.0-p451/bin:/usr/lib64/qt-3.3/bin:/usr/lib64/ccache:/usr/libexec/lightdm:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/usr/java/jdk1.7.0_40/bin/:.:/usr/local/rvm/bin:/home/<>/.local/bin:/home/<>/bin:/usr/java/jdk1.7.0_40/bin/:.
更新:
将 - /usr/lib64/ccache 添加到 XL C/C++ Compiler > Compiler Root Path,解决 "Compiler path does not exist on the local machine."
但仍然得到 -
Unable to get $PATH.
Unable to find full path for "gcc"
和-
Semantic Error:
Symbol 'vector' could not be resolved
所以 Eclipse 似乎没有正确找到 $PATH。
关于下一步的想法?
谢谢
这有效 -
- 编辑项目的环境设置(Properties/C/C++ Build / Environment)。如果 PATH 变量没有出现在这里或没有粗体打印,则取消该对话框并在 Window / Preferences / C/C++ Build / Environment). 中编辑它们
- 确保您的 PATH 变量设置包含字符串“:${PATH}”。它周围一定有花括号!如果该变量已经存在并且无论如何都没有解析,那么从您的操作系统获取它的值并将 ${PATH} 替换为该值。
在这里找到 - https://www.eclipse.org/forums/index.php/t/442732/
最初来自这里 - http://wiki.gimp.org/wiki/Hacking:Problems_and_solutions#Basic_tools_not_found_although_there
控制台错误消失,g++ 和 make 被 eclipse 发现,二进制文件编译。 Vector 现在也解析了。
OT:我继续从 class 头文件中删除了对命名空间 std 的引用。它现在只存在于 .cpp 文件中。