Author Topic: Problems with c++ source  (Read 5732 times)

Pix3l

  • Guest
Problems with c++ source
« on: October 12, 2006, 11:07:07 pm »
When i try to compile a c++ source i have strange error...

(the program it is that. it's the standard example of codeblocks)

#include <iostream>

int main()
{
   std::cout << "Hello world!" << std::endl;
   return 0;
}


(The build log are here)

Project   : Console application
Compiler  : GNU GCC Compiler (called directly)
Directory : C:\WINDOWS\Desktop\
--------------------------------------------------------------------------------
Switching to target: default
Compiling: main.cpp
In file included from D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/ios:44,
                 from D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/ostream:45,
                 from D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iostream:45,
                 from main.cpp:1:
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:49:65: bits/stringfwd.h: No such file or directory
In file included from D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/ios:44,
                 from D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/ostream:45,
                 from D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iostream:45,
                 from main.cpp:1:
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:55: error: `char_traits' has not been declared
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:55: error: expected `>' before '<' token
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:55: error: expected unqualified-id before '>' token
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:55: error: expected `;' before '>' token
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:58: error: `char_traits' has not been declared
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:58: error: expected `>' before '<' token
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:58: error: expected unqualified-id before '>' token
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:58: error: expected `;' before '>' token
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:61: error: `char_traits' has not been declared
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:61: error: expected `>' before '<' token
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:61: error: expected unqualified-id before '>' token
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:61: error: expected `;' before '>' token
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:64: error: `char_traits' has not been declared
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:64: error: expected `>' before '<' token
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:64: error: expected unqualified-id before '>' token
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:64: error: expected `;' before '>' token
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:67: error: `char_traits' has not been declared
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:67: error: expected `>' before '<' token
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:67: error: expected unqualified-id before '>' token
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:67: error: expected `;' before '>' token
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:70: error: `char_traits' has not been declared
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:70: error: expected `>' before '<' token
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:70: error: expected unqualified-id before ',' token
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:70: error: expected `;' before ',' token
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:74: error: `char_traits' has not been declared
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:74: error: expected `>' before '<' token
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:74: error: expected unqualified-id before ',' token
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:74: error: expected `;' before ',' token
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:78: error: `char_traits' has not been declared
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:78: error: expected `>' before '<' token
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:78: error: expected unqualified-id before ',' token
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:78: error: expected `;' before ',' token
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:82: error: `char_traits' has not been declared
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:82: error: expected `>' before '<' token
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:82: error: expected unqualified-id before ',' token
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:82: error: expected `;' before ',' token
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:86: error: `char_traits' has not been declared
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:86: error: expected `>' before '<' token
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:86: error: expected unqualified-id before '>' token
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:86: error: expected `;' before '>' token
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:89: error: `char_traits' has not been declared
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:89: error: expected `>' before '<' token
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:89: error: expected unqualified-id before '>' token
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:89: error: expected `;' before '>' token
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:92: error: `char_traits' has not been declared
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:92: error: expected `>' before '<' token
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:92: error: expected unqualified-id before '>' token
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:92: error: expected `;' before '>' token
D:/CODEBLOCKS/bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/iosfwd:95: error: `char_traits' has not been declared
Process terminated with status 1 (0 minutes, 11 seconds)
52 errors, 0 warnings

The library are all in the include directory (subfolder c++)

Why i get this error? :shock:

Offline Grom

  • Almost regular
  • **
  • Posts: 206
Re: Problems with c++ source
« Reply #1 on: October 13, 2006, 12:40:42 am »
Remove Code::Blocks from your computer and install agin :lol:
gcc+winXP+suse.

Offline Belgabor

  • Multiple posting newcomer
  • *
  • Posts: 91
Re: Problems with c++ source
« Reply #2 on: October 13, 2006, 01:47:09 am »
Seems like you got RC2 packaged with an old gcc version. I'd recommend to get the svn version of C::B and a current mingw install package with gcc 3.4.5

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Problems with c++ source
« Reply #3 on: October 13, 2006, 09:59:18 am »
Or, you could do a fresh MinGW install (search our WiKi for mingw), as this particular error is not directly related to Code::Blocks, but to a missing header file in MinGW.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Pix3l

  • Guest
Re: Problems with c++ source
« Reply #4 on: October 13, 2006, 01:25:03 pm »
Thanks for the help, reinstall code blocks and i recompile the cpp example and it works correctly!  :) But i have problem sometimes with other cpp sources  :(

Thanks again for the help! :D