符号'vector'无法解析//无法找到$ PATH

时间:2015-02-14 09:21:25

标签: c++ eclipse gcc

使用Eclipse Kepler,版本:4.3.1

CDT版本:8.3.0

PTP版本:7.0.5

在Fedora 19上 内核3.14.27-100.fc19.x86_64 x86_64 GNU / 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 ++编译器&gt;编译器根路径,解决了本地机器上不存在&#34;编译器路径。&#34;

但仍然得到 -

Unable to get $PATH.
Unable to find full path for "gcc"

和 -

Semantic Error: 
Symbol 'vector' could not be resolved

所以看起来Eclipse没有正确找到$ PATH。

关于后续步骤的想法?

由于

1 个答案:

答案 0 :(得分:0)

这很有效 -

  1. 编辑项目的环境设置(属性/ C / C ++构建/环境)。如果PATH变量不在此处显示或未以粗体显示,则取消该对话框并在Window / Preferences / C / C ++ Build / Environment中编辑它们。
  2. 确保您的PATH变量设置包含字符串&#39;:$ {PATH}&#39;。它必须有围绕它的花括号!如果变量已经存在并且无论如何都没有得到解决,那么从操作系统中获取它的值并用该值替换$ {PATH}。
  3. 在这里找到 - 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:我继续从类头文件中删除了对命名空间std的引用。它现在只在.cpp文件中。