Environment: Visual Studio 2008, C++ I am interfacing Barcode printer [TSC210] serially with controller [NXP A4], looked at other posts but not sure what is causing the problem and I am a beginner in C++. Can anyone suggest how to fix this error?
Getting error and warning case like:
1] main.cpp(11) : error C2059: syntax error : 'string'
2] main.cpp(11) : warning C4091: '__declspec(dllimport)' : ignored on left of 'int' when no variable is declared
I have the following code
#include <windows.h>
#define BUFFER_SIZE 32
#define Naked __declspec(naked)
#define DllImport __declspec( dllimport )
namespace TSCLIB
{
DllImport("TSCLIB.dll", EntryPoint = "about")
int about();
}
BOOL PortOpen(HANDLE *port, DWORD baudRate)
{
DCB portDCB; ///< COM port configuration structure.
BOOL returnValue = FALSE;
COMMTIMEOUTS comTimeOut;
/// Opens interface to reader.
/// COM Port Configuration.
/// Changes the DCB structure settings.
/// Configures the port according to the specifications of the DCB structure.
/// Gets communication time out values.
/// Sets communication time out values.
return TRUE;
}
BOOL PortClose(HANDLE *port)
{
if (*port == NULL)
{
return FALSE;
}
CloseHandle(*port);
*port = NULL;
return TRUE;
}
int wmain(void)
{
HANDLE portHandle;
while (TRUE)
{
// case WRITE:
}
// Closes the serial port.
}
}