#include <string>导致大量'<blank>'未声明错误</blank> </string>

时间:2012-11-17 01:13:41

标签: c++ linux std gcc4.7

我正在尝试编译我的'图形'引擎,但在包含<string>(Debian Testing 64bit)后出现问题。

这是错误:

jarrett@jarrett-g74s:~/projects/icebreak/ice_engine$ scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
g++ -o build/engine/gui/GUI.o -c -I"../lwis/src/engine" src/engine/gui/GUI.cpp
In file included from /usr/include/c++/4.7/bits/postypes.h:42:0,
                 from /usr/include/c++/4.7/bits/char_traits.h:42,
                 from /usr/include/c++/4.7/string:42,
                 from src/engine/gui/GUI.h:11,
                 from src/engine/gui/GUI.cpp:14:
/usr/include/c++/4.7/cwchar:66:11: error: ‘::mbstate_t’ has not been declared
/usr/include/c++/4.7/cwchar:141:11: error: ‘::wint_t’ has not been declared
/usr/include/c++/4.7/cwchar:143:11: error: ‘::btowc’ has not been declared
/usr/include/c++/4.7/cwchar:144:11: error: ‘::fgetwc’ has not been declared
/usr/include/c++/4.7/cwchar:145:11: error: ‘::fgetws’ has not been declared
/usr/include/c++/4.7/cwchar:146:11: error: ‘::fputwc’ has not been declared
/usr/include/c++/4.7/cwchar:147:11: error: ‘::fputws’ has not been declared
/usr/include/c++/4.7/cwchar:148:11: error: ‘::fwide’ has not been declared
/usr/include/c++/4.7/cwchar:149:11: error: ‘::fwprintf’ has not been declared
/usr/include/c++/4.7/cwchar:150:11: error: ‘::fwscanf’ has not been declared
/usr/include/c++/4.7/cwchar:151:11: error: ‘::getwc’ has not been declared
/usr/include/c++/4.7/cwchar:152:11: error: ‘::getwchar’ has not been declared
/usr/include/c++/4.7/cwchar:153:11: error: ‘::mbrlen’ has not been declared
/usr/include/c++/4.7/cwchar:154:11: error: ‘::mbrtowc’ has not been declared
/usr/include/c++/4.7/cwchar:155:11: error: ‘::mbsinit’ has not been declared
/usr/include/c++/4.7/cwchar:156:11: error: ‘::mbsrtowcs’ has not been declared
/usr/include/c++/4.7/cwchar:157:11: error: ‘::putwc’ has not been declared
/usr/include/c++/4.7/cwchar:158:11: error: ‘::putwchar’ has not been declared
/usr/include/c++/4.7/cwchar:160:11: error: ‘::swprintf’ has not been declared
/usr/include/c++/4.7/cwchar:162:11: error: ‘::swscanf’ has not been declared
/usr/include/c++/4.7/cwchar:163:11: error: ‘::ungetwc’ has not been declared
/usr/include/c++/4.7/cwchar:164:11: error: ‘::vfwprintf’ has not been declared
/usr/include/c++/4.7/cwchar:166:11: error: ‘::vfwscanf’ has not been declared
/usr/include/c++/4.7/cwchar:169:11: error: ‘::vswprintf’ has not been declared
/usr/include/c++/4.7/cwchar:172:11: error: ‘::vswscanf’ has not been declared
/usr/include/c++/4.7/cwchar:174:11: error: ‘::vwprintf’ has not been declared
/usr/include/c++/4.7/cwchar:176:11: error: ‘::vwscanf’ has not been declared
/usr/include/c++/4.7/cwchar:178:11: error: ‘::wcrtomb’ has not been declared
/usr/include/c++/4.7/cwchar:179:11: error: ‘::wcscat’ has not been declared
/usr/include/c++/4.7/cwchar:180:11: error: ‘::wcscmp’ has not been declared
/usr/include/c++/4.7/cwchar:181:11: error: ‘::wcscoll’ has not been declared
/usr/include/c++/4.7/cwchar:182:11: error: ‘::wcscpy’ has not been declared
/usr/include/c++/4.7/cwchar:183:11: error: ‘::wcscspn’ has not been declared
/usr/include/c++/4.7/cwchar:184:11: error: ‘::wcsftime’ has not been declared
/usr/include/c++/4.7/cwchar:185:11: error: ‘::wcslen’ has not been declared
/usr/include/c++/4.7/cwchar:186:11: error: ‘::wcsncat’ has not been declared
/usr/include/c++/4.7/cwchar:187:11: error: ‘::wcsncmp’ has not been declared
/usr/include/c++/4.7/cwchar:188:11: error: ‘::wcsncpy’ has not been declared
/usr/include/c++/4.7/cwchar:189:11: error: ‘::wcsrtombs’ has not been declared
/usr/include/c++/4.7/cwchar:190:11: error: ‘::wcsspn’ has not been declared
/usr/include/c++/4.7/cwchar:191:11: error: ‘::wcstod’ has not been declared
/usr/include/c++/4.7/cwchar:193:11: error: ‘::wcstof’ has not been declared
/usr/include/c++/4.7/cwchar:195:11: error: ‘::wcstok’ has not been declared
/usr/include/c++/4.7/cwchar:196:11: error: ‘::wcstol’ has not been declared
/usr/include/c++/4.7/cwchar:197:11: error: ‘::wcstoul’ has not been declared
/usr/include/c++/4.7/cwchar:198:11: error: ‘::wcsxfrm’ has not been declared
/usr/include/c++/4.7/cwchar:199:11: error: ‘::wctob’ has not been declared
/usr/include/c++/4.7/cwchar:200:11: error: ‘::wmemcmp’ has not been declared
/usr/include/c++/4.7/cwchar:201:11: error: ‘::wmemcpy’ has not been declared
/usr/include/c++/4.7/cwchar:202:11: error: ‘::wmemmove’ has not been declared
/usr/include/c++/4.7/cwchar:203:11: error: ‘::wmemset’ has not been declared
/usr/include/c++/4.7/cwchar:204:11: error: ‘::wprintf’ has not been declared
/usr/include/c++/4.7/cwchar:205:11: error: ‘::wscanf’ has not been declared
/usr/include/c++/4.7/cwchar:206:11: error: ‘::wcschr’ has not been declared
/usr/include/c++/4.7/cwchar:207:11: error: ‘::wcspbrk’ has not been declared
/usr/include/c++/4.7/cwchar:208:11: error: ‘::wcsrchr’ has not been declared
/usr/include/c++/4.7/cwchar:209:11: error: ‘::wcsstr’ has not been declared
/usr/include/c++/4.7/cwchar:210:11: error: ‘::wmemchr’ has not been declared
/usr/include/c++/4.7/cwchar:250:11: error: ‘::wcstold’ has not been declared
/usr/include/c++/4.7/cwchar:259:11: error: ‘::wcstoll’ has not been declared
/usr/include/c++/4.7/cwchar:260:11: error: ‘::wcstoull’ has not been declared
/usr/include/c++/4.7/cwchar:266:11: error: ‘::__gnu_cxx’ has not been declared
/usr/include/c++/4.7/cwchar:267:11: error: ‘::__gnu_cxx’ has not been declared
/usr/include/c++/4.7/cwchar:268:11: error: ‘::__gnu_cxx’ has not been declared
In file included from /usr/include/c++/4.7/string:42:0,
                 from src/engine/gui/GUI.h:11,
                 from src/engine/gui/GUI.cpp:14:
/usr/include/c++/4.7/bits/char_traits.h:65:15: error: ‘mbstate_t’ in namespace ‘icee::engine::std’ does not name a type
In file included from /usr/include/c++/4.7/ext/new_allocator.h:34:0,
                 from /usr/include/c++/4.7/x86_64-linux-gnu/bits/c++allocator.h:34,
                 from /usr/include/c++/4.7/bits/allocator.h:48,
                 from /usr/include/c++/4.7/string:43,
                 from src/engine/gui/GUI.h:11,
                 from src/engine/gui/GUI.cpp:14:
/usr/include/c++/4.7/new:94:41: error: ‘void* icee::engine::operator new(icee::engine::std::size_t)’ may not be declared within a namespace
/usr/include/c++/4.7/new:96:41: error: ‘void* icee::engine::operator new [](icee::engine::std::size_t)’ may not be declared within a namespace
/usr/include/c++/4.7/new:98:41: error: ‘void icee::engine::operator delete(void*)’ may not be declared within a namespace
/usr/include/c++/4.7/new:100:41: error: ‘void icee::engine::operator delete [](void*)’ may not be declared within a namespace
/usr/include/c++/4.7/new:102:41: error: ‘void* icee::engine::operator new(icee::engine::std::size_t, const icee::engine::std::nothrow_t&)’ may not be declared within a namespace
/usr/include/c++/4.7/new:104:41: error: ‘void* icee::engine::operator new [](icee::engine::std::size_t, const icee::engine::std::nothrow_t&)’ may not be declared within a namespace
/usr/include/c++/4.7/new:106:41: error: ‘void icee::engine::operator delete(void*, const icee::engine::std::nothrow_t&)’ may not be declared within a namespace
/usr/include/c++/4.7/new:108:41: error: ‘void icee::engine::operator delete [](void*, const icee::engine::std::nothrow_t&)’ may not be declared within a namespace
/usr/include/c++/4.7/new:111:51: error: ‘void* icee::engine::operator new(icee::engine::std::size_t, void*)’ may not be declared within a namespace
/usr/include/c++/4.7/new:113:53: error: ‘void* icee::engine::operator new [](icee::engine::std::size_t, void*)’ may not be declared within a namespace
/usr/include/c++/4.7/new:117:45: error: ‘void icee::engine::operator delete(void*, void*)’ may not be declared within a namespace
/usr/include/c++/4.7/new:118:45: error: ‘void icee::engine::operator delete [](void*, void*)’ may not be declared within a namespace
In file included from /usr/include/c++/4.7/x86_64-linux-gnu/bits/c++locale.h:42:0,
                 from /usr/include/c++/4.7/bits/localefwd.h:42,
                 from /usr/include/c++/4.7/string:45,
                 from src/engine/gui/GUI.h:11,
                 from src/engine/gui/GUI.cpp:14:
/usr/include/c++/4.7/clocale:55:11: error: ‘::lconv’ has not been declared
/usr/include/c++/4.7/clocale:56:11: error: ‘::setlocale’ has not been declared
/usr/include/c++/4.7/clocale:57:11: error: ‘::localeconv’ has not been declared
In file included from /usr/include/c++/4.7/bits/localefwd.h:44:0,
                 from /usr/include/c++/4.7/string:45,
                 from src/engine/gui/GUI.h:11,
                 from src/engine/gui/GUI.cpp:14:
/usr/include/c++/4.7/cctype:66:11: error: ‘::isalnum’ has not been declared
/usr/include/c++/4.7/cctype:67:11: error: ‘::isalpha’ has not been declared
/usr/include/c++/4.7/cctype:68:11: error: ‘::iscntrl’ has not been declared
/usr/include/c++/4.7/cctype:69:11: error: ‘::isdigit’ has not been declared
/usr/include/c++/4.7/cctype:70:11: error: ‘::isgraph’ has not been declared
/usr/include/c++/4.7/cctype:71:11: error: ‘::islower’ has not been declared
/usr/include/c++/4.7/cctype:72:11: error: ‘::isprint’ has not been declared
/usr/include/c++/4.7/cctype:73:11: error: ‘::ispunct’ has not been declared
/usr/include/c++/4.7/cctype:74:11: error: ‘::isspace’ has not been declared
/usr/include/c++/4.7/cctype:75:11: error: ‘::isupper’ has not been declared
/usr/include/c++/4.7/cctype:76:11: error: ‘::isxdigit’ has not been declared
/usr/include/c++/4.7/cctype:77:11: error: ‘::tolower’ has not been declared
/usr/include/c++/4.7/cctype:78:11: error: ‘::toupper’ has not been declared
src/engine/gui/GUI.cpp:16:1: error: ‘GUI’ does not name a type
src/engine/gui/GUI.cpp:20:1: error: ‘GUI’ does not name a type
src/engine/gui/GUI.cpp:24:5: error: ‘GUI’ has not been declared
src/engine/gui/GUI.cpp:32:6: error: ‘GUI’ has not been declared
src/engine/gui/GUI.cpp:36:6: error: ‘GUI’ has not been declared
src/engine/gui/GUI.cpp:40:1: error: ‘GUIComponent’ does not name a type
scons: *** [build/engine/gui/GUI.o] Error 1
scons: building terminated because of errors.

GUI.h是:

#ifndef GUI_H_
#define GUI_H_

#include <string>

#include "IGUI.h"

namespace icee {

namespace engine {

class GUI : public IGUI {
public:
    GUI();
    virtual ~GUI();

    virtual int initialize();
    virtual void destroy();

    virtual void render();
    virtual IGUIComponent* load(std::string filename);
};

}

}

#endif /* GUI_H_ */

GUI.cpp是:

namespace icee {

namespace engine {

#include <berkelium/Berkelium.hpp>

#include "GUI.h"

GUI::GUI() {

}

GUI::~GUI() {

}

int GUI::initialize() {
    if (!Berkelium::init(Berkelium::FileString::empty())) {
        return -1;
    }

    return 0;
}

void GUI::destroy() {

}

void GUI::render() {

}

GUIComponent* GUI::load(std::string filename) {

}

}

}

IGUI.h看起来像这样:

#ifndef IGUI_H_
#define IGUI_H_

#include <string>

#include "IGUIComponent.h"

namespace icee {

namespace engine {

class IGUI {
public:
    IGUI();
    virtual ~IGUI();

    virtual int initialize() = 0;
    virtual void destroy() = 0;

    virtual void render() = 0;
    virtual IGUIComponent* load(std::string filename) = 0;
};

}

}

#endif /* IGUI_H_ */
到目前为止,我有点难过。我尝试安装build-essentials,但它已经安装完毕。经过一些谷歌搜索似乎问题是某些地方有一些缺失的依赖,但我不知道在哪里......

有人有什么想法吗?

干杯

2 个答案:

答案 0 :(得分:13)

您的问题 包含的内容是:

namespace icee {

namespace engine {

#include <berkelium/Berkelium.hpp>

#include "GUI.h"

将它们移出命名空间。

答案 1 :(得分:2)

原来我只是个白痴 - 我在命名空间范围内有GUI.cpp的包含...我将它们移到上面并且工作正常。

:\