Search code examples
c++windowsmingwgnustdint

Equivalent of u_int16_t from windows stdint.h in gnu?


So far I'm assuming that u_int16_t is a windows type somewhere inside of an MSVS header file called stdint.h. I'm using GNU g++ for a compiler (actually codeblocks with mingw) and I wondered if typedef unsigned short uint_least16_t; (inside stdint.h for mingw) is the equivalent or what could I do to include this type?

This question is actually in relation to compiling the google sparsehash project files meant for MSVS but I'm using codeblocks. This was the error it gave me (btw, the error repeated many times over).

c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|40|error: 'u_int16_t' does not name a type|

Heres the full log up to 50 errors.

||=== simple_test, Debug Win32 ===|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|40|error: 'u_int16_t' does not name a type|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|563|error: 'u_int16_t' has not been declared|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|582|error: 'u_int16_t' does not name a type|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|637|error: 'size_type' does not name a type|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|638|error: 'size_type' does not name a type|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|639|error: 'size_type' has not been declared|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|640|error: 'size_type' has not been declared|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|641|error: 'size_type' has not been declared|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|643|error: 'size_type' has not been declared|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|665|error: 'size_type' does not name a type|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|698|error: 'size_type' does not name a type|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|708|error: 'size_type' does not name a type|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|717|error: 'size_type' does not name a type|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|742|error: 'size_type' does not name a type|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|798|error: 'size_type' does not name a type|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|799|error: 'size_type' does not name a type|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|802|error: 'size_type' does not name a type|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|807|error: 'size_type' has not been declared|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|817|error: 'size_type' has not been declared|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|823|error: 'size_type' has not been declared|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|831|error: 'size_type' has not been declared|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|835|error: 'size_type' has not been declared|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|847|error: 'size_type' has not been declared|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|857|error: 'size_type' has not been declared|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|871|error: 'size_type' has not been declared|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|895|error: 'size_type' has not been declared|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|910|error: 'size_type' has not been declared|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|924|error: 'size_type' has not been declared|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|939|error: 'size_type' has not been declared|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|1093|error: 'u_int16_t' has not been declared|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|1098|error: 'u_int16_t' does not name a type|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable||In member function 'google::table_iterator<google::sparsegroup<T, GROUP_SIZE, Alloc> > google::sparsegroup<T, GROUP_SIZE, Alloc>::end()':|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|597|error: there are no arguments to 'size' that depend on a template parameter, so a declaration of 'size' must be available|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|597|note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable||In member function 'google::const_table_iterator<google::sparsegroup<T, GROUP_SIZE, Alloc> > google::sparsegroup<T, GROUP_SIZE, Alloc>::end() const':|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|598|error: there are no arguments to 'size' that depend on a template parameter, so a declaration of 'size' must be available|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable||In member function 'int google::sparsegroup<T, GROUP_SIZE, Alloc>::bmtest(int) const':|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|639|error: there are no arguments to 'charbit' that depend on a template parameter, so a declaration of 'charbit' must be available|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|639|error: there are no arguments to 'modbit' that depend on a template parameter, so a declaration of 'modbit' must be available|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable||In member function 'void google::sparsegroup<T, GROUP_SIZE, Alloc>::bmset(int)':|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|640|error: there are no arguments to 'charbit' that depend on a template parameter, so a declaration of 'charbit' must be available|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|640|error: there are no arguments to 'modbit' that depend on a template parameter, so a declaration of 'modbit' must be available|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable||In member function 'void google::sparsegroup<T, GROUP_SIZE, Alloc>::bmclear(int)':|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|641|error: there are no arguments to 'charbit' that depend on a template parameter, so a declaration of 'charbit' must be available|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|641|error: there are no arguments to 'modbit' that depend on a template parameter, so a declaration of 'modbit' must be available|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable||In member function 'void google::sparsegroup<T, GROUP_SIZE, Alloc>::set_aux(int, google::true_type)':|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|851|error: 'size_type' was not declared in this scope|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|851|error: expected ';' before 'i'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|851|error: 'i' was not declared in this scope|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable||In member function 'typename Alloc::rebind<T>::other::reference google::sparsegroup<T, GROUP_SIZE, Alloc>::set(int, typename Alloc::rebind<T>::other::const_reference)':|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|872|error: 'size_type' was not declared in this scope|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|872|error: expected ';' before 'offset'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|875|error: 'offset' was not declared in this scope|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|884|error: 'offset' was not declared in this scope|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|890|error: 'offset' was not declared in this scope|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable||In member function 'void google::sparsegroup<T, GROUP_SIZE, Alloc>::erase_aux(int, google::true_type)':|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|917|error: 'size_type' was not declared in this scope|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|917|error: expected ';' before 'i'|
c:\program files\codeblocks\mingw\bin\..\lib\gcc\mingw32\4.4.1\..\..\..\..\include\sparsehash\sparsetable|917|error: 'i' was not declared in this scope|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build finished: 50 errors, 0 warnings ===|

Solution

  • If you haven't any header which defines u_int16_t. Do it yourself :

    #include <stdint.h>
    #include <stddef.h>
    
    typedef uint16_t u_int16_t;
    typedef size_t size_type;