Код
// 1.cpp : Defines the entry point for the console application.
//
#include <stdafx.h>
#include "targetver.h"
#include <iostream>
#include <windows.h>
//#include <winbase.h>
//-----------------------
using namespace std; // for <iostream>
char quit;
static char* sysdev[] = {
"COM1:",
"COM2:",
"COM3:",
"COM4:",
NULL
};
HANDLE hPort;
//------------------------
//SerialPort system_port;
int _tmain(int argc, _TCHAR* argv[])
{
//------------------------------------------------------------------------------
// Open the serial port.//lpszPortName
hPort=CreateFile("COM2",GENERIC_READ|GENERIC_WRITE,0,NULL,OPEN_EXISTING,0,NULL);
cout << "configurator V.0.0.1a" << endl;
quit = '\0';
while(quit != 'q')
{
cin >> quit;
}
return 0;
}
//
#include <stdafx.h>
#include "targetver.h"
#include <iostream>
#include <windows.h>
//#include <winbase.h>
//-----------------------
using namespace std; // for <iostream>
char quit;
static char* sysdev[] = {
"COM1:",
"COM2:",
"COM3:",
"COM4:",
NULL
};
HANDLE hPort;
//------------------------
//SerialPort system_port;
int _tmain(int argc, _TCHAR* argv[])
{
//------------------------------------------------------------------------------
// Open the serial port.//lpszPortName
hPort=CreateFile("COM2",GENERIC_READ|GENERIC_WRITE,0,NULL,OPEN_EXISTING,0,NULL);
cout << "configurator V.0.0.1a" << endl;
quit = '\0';
while(quit != 'q')
{
cin >> quit;
}
return 0;
}
ошибка
Цитата
------ Build started: Project: 1, Configuration: Debug Win32 ------
Compiling...
1.cpp
e:\documents and settings\kornilov\мои документы\visual studio 2008\projects\mainwork\1\1\1.cpp(56) : error C2664: 'CreateFileW' : cannot convert parameter 1 from 'const char [5]' to 'LPCWSTR'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Build log was saved at "file://e:\Documents and Settings\KoRniloV\Мои документы\Visual Studio 2008\Projects\mainWORK\1\1\Debug\BuildLog.htm"
1 - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Compiling...
1.cpp
e:\documents and settings\kornilov\мои документы\visual studio 2008\projects\mainwork\1\1\1.cpp(56) : error C2664: 'CreateFileW' : cannot convert parameter 1 from 'const char [5]' to 'LPCWSTR'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Build log was saved at "file://e:\Documents and Settings\KoRniloV\Мои документы\Visual Studio 2008\Projects\mainWORK\1\1\Debug\BuildLog.htm"
1 - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
что самое интересное пробовал тотже самое на другом компиляторе DEV-C++4.9 собирается нормально ?