' belum dideklarasikan'/> ' belum dideklarasikan'/> ' belum dideklarasikan'/> #include <string> menyebabkan banyak kesalahan '<blank>' belum dideklarasikan | gomecomputer.com

Pertanyaan #include menyebabkan banyak kesalahan '' belum dideklarasikan


Saya mencoba untuk mengkompilasi mesin 'grafik' saya, tetapi saya memiliki masalah setelah memasukkan <string> (Pengujian Debian 64bit).

Inilah kesalahannya:

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.

Itu GUI.h aku s:

#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_ */

dan GUI.cpp aku s:

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) {

}

}

}

dan IGUI.h terlihat seperti ini:

#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_ */

Sejauh ini saya agak bingung. Saya mencoba menginstal build-essentials, tetapi sudah diinstal. Setelah beberapa googling sepertinya masalah adalah bahwa ada beberapa dependensi yang hilang di suatu tempat, tapi saya tidak tahu di mana ...

Ada yang punya ide?

Tepuk tangan


4
2017-11-17 01:13


asal


Jawaban:


Masalah Anda adalah dimana termasuk:

namespace icee {

namespace engine {

#include <berkelium/Berkelium.hpp>

#include "GUI.h"

memindahkannya di luar namespace.


13
2017-11-17 01:18



ternyata saya hanya idiot - saya punya termasuk untuk GUI.cpp dalam ruang lingkup namespace ... Saya memindahkannya ke atas dan berfungsi dengan baik.

: \


2
2017-11-17 01:17