User forums > General (but related to Code::Blocks)
Problem Building project with Code::Block
arashfahim:
Hi,
I am an absolute beginner in C++ and I installed full version of Code::Block in my Laptop. I tried to run the "Hello World!" program as the first program. I received the following error.
--- Quote ----------------- Build: Debug in test1 ---------------
mingw32-g++.exe -Wall -fexceptions -g -I"C:\Program Files\CodeBlocks\MinGW\lib\gcc\mingw32\4.4.1\include" -I"C:\Program Files\CodeBlocks\MinGW\lib\gcc\mingw32\4.4.1\include\c++" -I"C:\Program Files\CodeBlocks\MinGW\lib\gcc\mingw32\4.4.1\include\c++\backward" -I"C:\Program Files\CodeBlocks\MinGW\lib\gcc\mingw32\4.4.1\include\c++\mingw32" -I"C:\Program Files\CodeBlocks\MinGW\lib\gcc\mingw32\4.4.1\include\c++\bits" -I"C:\Program Files\CodeBlocks\MinGW\lib\gcc\mingw32\4.4.1\include\c++\debug" -I"C:\Program Files\CodeBlocks\MinGW\lib\gcc\mingw32\4.4.1\include\c++\ext" -I"C:\Program Files\CodeBlocks\MinGW\lib\gcc\mingw32\4.4.1\include\c++\mingw32\bits" -c "C:\Documents and Settings\user\Desktop\C++tests\test1\main.cpp" -o obj\Debug\main.o
In file included from c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/ios:43,
from c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/ostream:40,
from c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/iostream:40,
from C:\Documents and Settings\user\Desktop\C++tests\test1\main.cpp:2:
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/ios_base.h:234: error: field '_M_msg' has incomplete type
In file included from c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/basic_ios.h:39,
from c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/ios:45,
from c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/ostream:40,
from c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/iostream:40,
from C:\Documents and Settings\user\Desktop\C++tests\test1\main.cpp:2:
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/locale_facets.h: In member function 'std::string std::numpunct<_CharT>::grouping() const':
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/locale_facets.h:1746: error: return type 'struct std::string' is incomplete
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/locale_facets.h: In member function 'virtual std::string std::numpunct<_CharT>::do_grouping() const':
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/locale_facets.h:1814: error: return type 'struct std::string' is incomplete
In file included from c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/locale_facets.h:2599,
from c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/basic_ios.h:39,
from c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/ios:45,
from c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/ostream:40,
from c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/iostream:40,
from C:\Documents and Settings\user\Desktop\C++tests\test1\main.cpp:2:
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/locale_facets.tcc: In member function '_InIter std::num_get<_CharT, _InIter>::_M_extract_float(_InIter, _InIter, std::ios_base&, std::_Ios_Iostate&, std::string&) const':
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/locale_facets.tcc:192: error: invalid use of incomplete type 'struct std::string'
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/stringfwd.h:52: error: declaration of 'struct std::string'
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/locale_facets.tcc:263: error: invalid use of incomplete type 'struct std::basic_string<char, std::char_traits<char>, std::allocator<char> >'
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/stringfwd.h:52: error: declaration of 'struct std::basic_string<char, std::char_traits<char>, std::allocator<char> >'
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/locale_facets.tcc:277: error: invalid use of incomplete type 'struct std::string'
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/stringfwd.h:52: error: declaration of 'struct std::string'
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/locale_facets.tcc:300: error: invalid use of incomplete type 'struct std::string'
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/stringfwd.h:52: error: declaration of 'struct std::string'
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/locale_facets.tcc:336: error: invalid use of incomplete type 'struct std::string'
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/stringfwd.h:52: error: declaration of 'struct std::string'
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/locale_facets.tcc: In member function '_InIter std::num_get<_CharT, _InIter>::_M_extract_int(_InIter, _InIter, std::ios_base&, std::_Ios_Iostate&, _ValueT&) const':
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/locale_facets.tcc:448: error: invalid use of incomplete type 'struct std::string'
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/stringfwd.h:52: error: declaration of 'struct std::string'
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/locale_facets.tcc:534: error: invalid use of incomplete type 'struct std::string'
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/stringfwd.h:52: error: declaration of 'struct std::string'
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/locale_facets.tcc:547: error: invalid use of incomplete type 'struct std::string'
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/stringfwd.h:52: error: declaration of 'struct std::string'
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/locale_facets.tcc: In member function 'virtual _InIter std::num_get<_CharT, _InIter>::do_get(_InIter, _InIter, std::ios_base&, std::_Ios_Iostate&, float&) const':
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/locale_facets.tcc:675: error: invalid use of incomplete type 'struct std::string'
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/stringfwd.h:52: error: declaration of 'struct std::string'
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/locale_facets.tcc:677: error: invalid use of incomplete type 'struct std::string'
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/stringfwd.h:52: error: declaration of 'struct std::string'
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/locale_facets.tcc: In member function 'virtual _InIter std::num_get<_CharT, _InIter>::do_get(_InIter, _InIter, std::ios_base&, std::_Ios_Iostate&, double&) const':
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/locale_facets.tcc:690: error: invalid use of incomplete type 'struct std::string'
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/stringfwd.h:52: error: declaration of 'struct std::string'
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/locale_facets.tcc:692: error: invalid use of incomplete type 'struct std::string'
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/stringfwd.h:52: error: declaration of 'struct std::string'
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/locale_facets.tcc: In member function 'virtual _InIter std::num_get<_CharT, _InIter>::do_get(_InIter, _InIter, std::ios_base&, std::_Ios_Iostate&, long double&) const':
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/locale_facets.tcc:722: error: invalid use of incomplete type 'struct std::string'
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/stringfwd.h:52: error: declaration of 'struct std::string'
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/locale_facets.tcc:724: error: invalid use of incomplete type 'struct std::string'
c:\program files\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/bits/stringfwd.h:52: error: declaration of 'struct std::string'
Process terminated with status 1 (0 minutes, 0 seconds)
31 errors, 0 warnings
--- End quote ---
I tried to reinstall Code::Block, but it gave me the same error. I also tried to google the error but no success.
I appreciate you experts to help me remove the problem.
Thanks a lot
stahta01:
Did you re-install the Compiler?
If not, I suggest trying it.
Tim S.
arashfahim:
Yes, I reinstalled it. I chose full installation. But, still got the same error.
ollydbg:
--- Quote from: arashfahim on October 04, 2010, 12:31:23 am ---I tried to run the "Hello World!" program as the first program.
--- End quote ---
some suggestions:
1, give us the full steps how you create and build the "hello world" program.
2, the minimal sample code of the "hello world" program.
3, use .cpp (not .c).
arashfahim:
--- Quote from: ollydbg on October 04, 2010, 02:16:22 am ---
--- Quote from: arashfahim on October 04, 2010, 12:31:23 am ---I tried to run the "Hello World!" program as the first program.
--- End quote ---
some suggestions:
1, give us the full steps how you create and build the "hello world" program.
2, the minimal sample code of the "hello world" program.
3, use .cpp (not .c).
--- End quote ---
I did it in 2 ways.
First I created an empty file main.cpp. I put the following on the file:
--- Quote ---#include<iostream>
using namespace std;
int main(){
cout <<"Hello World!" << endl;
return 0;
}
--- End quote ---
Then F9.
Second through New>Project>Console Application
choosing C++ and naming the project as test1. Then F9.
I took your advice. The file is called main.cpp not .c. But the problem still exists.
Navigation
[0] Message Index
[#] Next page
Go to full version