cannot convert parameter 1 from 'char' to 'LPCWSTR'

前端 未结 5 896
遥遥无期
遥遥无期 2020-12-02 20:14

I keep getting this error: cannot convert parameter 1 from \'char\' to \'LPCWSTR\'

int main(int argc, char argv[])    
{

   // open port for I/         


        
5条回答
  •  无人及你
    2020-12-02 21:11

    This is the main function that Visual Studio creates by default:

    int _tmain(int argc, _TCHAR* argv[])
    

    Where _TCHAR is defined to be char or wchar_t depending if _UNICODE is defined or not. The same thing happens with API functions. I would advise you against using explicit CreateFileA. Change your main and use CreateFile.

提交回复
热议问题