Frage zu STL Kontainern (deque/vector)
-
Hiho,
ich bekomme beim kompilieren eine warnung, aus der ich nicht schlau werde. Kann mir das mal jemand ins deutsche übersetzen (oder zumindest ins fach-chinesische
) ?Das Programm-snippet bei dem es auftaucht sieht etwa so aus:
#include <deque> #include <string> #include <iostream> using namespace std; int main(int argc, char* argv[]) { deque<string> deq; deq.push_back("bla"); deque<string>::iterator iter; for (iter = deq.begin(); iter != deq.end(); iter++) { cout << *iter << endl; } return 0; }Die fehlermeldung die ich (gleich vier mal) bekomme ist:
c:\arbeit\dev\deqtest\deqtest.cpp(17) : warning C4786: 'std::reverse_iterator<std::deque<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::co
nst_iterator,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &,std::basic_string<char,std::char_traits<char>,std::allocator<char> > const *,int>' : ident
ifier was truncated to '255' characters in the debug information
c:\arbeit\dev\deqtest\deqtest.cpp(17) : warning C4786: 'std::reverse_iterator<std::deque<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::it
erator,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> > &,std::basic_string<char,std::char_traits<char>,std::allocator<char> > *,int>' : identifier was truncate
d to '255' characters in the debug information
c:\programme\microsoft visual studio\vc98\include\deque(191) : warning C4786: 'std::deque<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::d
eque<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >' : identifier was truncated to '255' characters in the debug information
c:\programme\microsoft visual studio\vc98\include\deque(208) : warning C4786: 'std::deque<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::~
deque<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >' : identifier was truncated to '255' characters in the debug information
Linking...deqtest.exe - 0 error(s), 4 warning(s)
Was will mir diese Werbesendung sagen?

Wie kann ich das vermeiden? Ist das kritisch (und wenn ja: wann? Soweit ich sehe läuft alles so wie es soll)(Visual C++ 6.0)
-
Mit Dev-C++ 4.9.9.2 läuft das problemlos.
Compiler: Default compiler
Führt g++.exe... aus
g++.exe "...\C++_Tests\stl001.cpp" -o "...\C++_Tests\stl001.exe" -pg -g3 -I"...\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"...\Dev-Cpp\include\c++\3.4.2\backward" -I"...\Dev-Cpp\include\c++\3.4.2\mingw32" -I"...\Dev-Cpp\include\c++\3.4.2" -I"...\Dev-Cpp\include" -L"...\Dev-Cpp\lib" -lgmon -pg -g3
Ausführung beendet
Kompilierung erfolgreichMS-Bug (VC++ 5 u. 6). Baue einfach dies davor:
#ifdef _MSC_VER // turn off symbol length warnings #pragma warning (disable: 4786) #pragma warning (disable: 4503) #endifsiehe auch: http://support.microsoft.com/kb/195386/de und
http://support.microsoft.com/kb/167355/
-
Die Warnung kannst du eigentlich ignorieren (oder wie Edward vorgeführt hat, ausschalten). Die besagt, daß die verwendeten Namen zu lang werden, um in die Debug-Informationen gepackt werden zu können (wenn du "deque<string>" ausschreibst, ergibt das "std::deque<std::basic_string<char,std::char_traits<char,std::allocator<char>,std::allocator<std::basic_string<char,std::char_traits<char,std::allocator<char> >" (ein Glück, daß niemand den Bandwurm von Hand schreiben muß :D) - der dazu gehörige reverse_iterator wird noch ein gutes Stück länger.
-
Danke. Ich dachte schon der string den ich in die deque hängen kann wäre irgendwie auf 255 zeichen beschränkt. werde das mit dem #pragma anwenden. das beruhigt mich doch jetzt wieder
