Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use the types WORD, UCHAR, ULONG, USHORT in C++?

I have created a Win32 Console Project in Visual Studio 2010. In this project I would like to use an external library with corresponding headers. The header files includes variables declared as

  • UCHAR
  • ULONG
  • USHORT
  • WORD

stated as above in captitals. Having done very little programming in C++, I don't recognise these types and I do get errors for each line of code containing them:

WORD myVariable;

Error:

error C2146: syntax error : missing ';' before identifier 'myVariable'

This is probably a very simple thing, but would like some help to increase my C++ knowledge.

What do I need to be able to use these types?

like image 607
Chau Avatar asked Dec 07 '22 03:12

Chau


1 Answers

These types are defined in windows.h, so you need to put #include <windows.h> somewhere.

In your case, you probably need to put it in before the header of the external library you're mentioning:

#include <windows.h>
// Possibly other stuff here...
#include <external-library.h>
like image 58
Magnus Hoff Avatar answered Dec 08 '22 17:12

Magnus Hoff