[ENet-discuss] Using enet with C++

ingmar wirths ingmania at googlemail.com
Wed Jul 30 08:55:47 PDT 2008


Hello,

i was trying to use enet with c++ and ran into trouble.
My code is as simple as possible:

#include <iostream>
#include <enet.h>

int main()
{
  std::cout << "enet-test" << std::endl;
}

When i try to compile it, i get this:

/usr/include/c++/4.1.3/ctime:67: error: '::clock_t' has not been declared
/usr/include/c++/4.1.3/ctime:68: error: '::time_t' has not been declared
/usr/include/c++/4.1.3/ctime:69: error: '::tm' has not been declared
/usr/include/c++/4.1.3/ctime:71: error: '::clock' has not been declared
/usr/include/c++/4.1.3/ctime:72: error: '::difftime' has not been declared
/usr/include/c++/4.1.3/ctime:73: error: '::mktime' has not been declared
/usr/include/c++/4.1.3/ctime:74: error: '::time' has not been declared
/usr/include/c++/4.1.3/ctime:75: error: '::asctime' has not been declared
/usr/include/c++/4.1.3/ctime:76: error: '::ctime' has not been declared
/usr/include/c++/4.1.3/ctime:77: error: '::gmtime' has not been declared
/usr/include/c++/4.1.3/ctime:78: error: '::localtime' has not been declared
/usr/include/c++/4.1.3/ctime:79: error: '::strftime' has not been declared
/usr/include/c++/4.1.3/bits/locale_facets.tcc: In member function
'_InIter std::time_get<_CharT,
_InIter>::_M_extract_via_format(_InIter, _InIter, std::ios_base&,
std::_Ios_Iostate&, tm*, const _CharT*) const':
/usr/include/c++/4.1.3/bits/locale_facets.tcc:1831: error: invalid use
of undefined type 'struct tm'
/usr/include/wchar.h:123: error: forward declaration of 'struct tm'
/usr/include/c++/4.1.3/bits/locale_facets.tcc:1838: error: invalid use
of undefined type 'struct tm'
/usr/include/wchar.h:123: error: forward declaration of 'struct tm'
/usr/include/c++/4.1.3/bits/locale_facets.tcc:1846: error: invalid use
of undefined type 'struct tm'
/usr/include/wchar.h:123: error: forward declaration of 'struct tm'
/usr/include/c++/4.1.3/bits/locale_facets.tcc:1853: error: invalid use
of undefined type 'struct tm'
/usr/include/wchar.h:123: error: forward declaration of 'struct tm'
/usr/include/c++/4.1.3/bits/locale_facets.tcc:1865: error: invalid use
of undefined type 'struct tm'
/usr/include/wchar.h:123: error: forward declaration of 'struct tm'
/usr/include/c++/4.1.3/bits/locale_facets.tcc:1872: error: invalid use
of undefined type 'struct tm'
/usr/include/wchar.h:123: error: forward declaration of 'struct tm'
/usr/include/c++/4.1.3/bits/locale_facets.tcc:1875: error: invalid use
of undefined type 'struct tm'
/usr/include/wchar.h:123: error: forward declaration of 'struct tm'
/usr/include/c++/4.1.3/bits/locale_facets.tcc:1887: error: invalid use
of undefined type 'struct tm'
/usr/include/wchar.h:123: error: forward declaration of 'struct tm'
/usr/include/c++/4.1.3/bits/locale_facets.tcc:1892: error: invalid use
of undefined type 'struct tm'
/usr/include/wchar.h:123: error: forward declaration of 'struct tm'
/usr/include/c++/4.1.3/bits/locale_facets.tcc:1900: error: invalid use
of undefined type 'struct tm'
/usr/include/wchar.h:123: error: forward declaration of 'struct tm'
/usr/include/c++/4.1.3/bits/locale_facets.tcc:1904: error: invalid use
of undefined type 'struct tm'
/usr/include/wchar.h:123: error: forward declaration of 'struct tm'
/usr/include/c++/4.1.3/bits/locale_facets.tcc:1924: error: invalid use
of undefined type 'struct tm'
/usr/include/wchar.h:123: error: forward declaration of 'struct tm'
/usr/include/c++/4.1.3/bits/locale_facets.tcc:1960: error: invalid use
of undefined type 'struct tm'
/usr/include/wchar.h:123: error: forward declaration of 'struct tm'
/usr/include/c++/4.1.3/bits/locale_facets.tcc:1968: error: invalid use
of undefined type 'struct tm'
/usr/include/wchar.h:123: error: forward declaration of 'struct tm'
/usr/include/c++/4.1.3/bits/locale_facets.tcc: In member function
'virtual _InIter std::time_get<_CharT,
_InIter>::do_get_weekday(_InIter, _InIter, std::ios_base&,
std::_Ios_Iostate&, tm*) const':
/usr/include/c++/4.1.3/bits/locale_facets.tcc:2194: error: invalid use
of undefined type 'struct tm'
/usr/include/wchar.h:123: error: forward declaration of 'struct tm'
/usr/include/c++/4.1.3/bits/locale_facets.tcc: In member function
'virtual _InIter std::time_get<_CharT,
_InIter>::do_get_monthname(_InIter, _InIter, std::ios_base&,
std::_Ios_Iostate&, tm*) const':
/usr/include/c++/4.1.3/bits/locale_facets.tcc:2240: error: invalid use
of undefined type 'struct tm'
/usr/include/wchar.h:123: error: forward declaration of 'struct tm'
/usr/include/c++/4.1.3/bits/locale_facets.tcc: In member function
'virtual _InIter std::time_get<_CharT, _InIter>::do_get_year(_InIter,
_InIter, std::ios_base&, std::_Ios_Iostate&, tm*) const':
/usr/include/c++/4.1.3/bits/locale_facets.tcc:2267: error: invalid use
of undefined type 'struct tm'
/usr/include/wchar.h:123: error: forward declaration of 'struct tm'

The g++ version is 4.1, my OS is Ubuntu 7.10
I tried to wrap the include enet in extern "C", with no effect.
The versions of enet i tried where 1.1-1, the current Ubuntu release,
and 1.2, downloaded from http://enet.bespin.org

Note that commenting out the include iostream avoids all these errors,
but i believe the problem is not with iostream.

Thanks in advance
ingmar


More information about the ENet-discuss mailing list