This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: in g++(invalid use of incomplete type)


On 11 July 2011 07:32, eric wrote:
> Dear c++ programers:
>
> ?If you are also an g++ programers, especially ever create/modify its
> source code, I need your help
> I have a piece simple code about formatting a date/time as a string
> from a book. ?its authors claim it work in vc++7.1 on xp.
> but my g++4.5.2 didn't pass it on compile stage

You need to learn to solve these problems yourself, or you're not
learning anything.

> -------------------------------------------------------------------------------------------
> eric@eric-laptop:~/cppcookbook/ch5$ g++ Example5-4.cpp
> Example5-4.cpp: In function ‘std::ostream&
> formatDatetime(std::ostream&, const tm&, const char*)’:
> Example5-4.cpp:16:17: error: invalid use of incomplete type ‘const
> struct std::time_put<char>’

The compiler tells you the type "time_put" is not defined, so you
probably haven't included the header that defines it.

Look at any reference (e.g.
http://dinkumware.com/manuals/default.aspx?manual=compleat&page=locale2.html#time_put
or http://cplusplus.com/reference/std/locale/time_put/) and you'll
find you need to #include <locale>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]