close

Cannot convert argument 1 from 'const wchar_t [16]' to 'LPTSTR'

 

 

最近因為一些原因,所以又開始寫起C++,所以就繼續將所遇到的問題記錄下來,以便日後拯救未來的自己。

 

error C2664: 'BOOL GetRegString(LPWSTR,LPWSTR,LPWSTR)': cannot convert argument 1 from 'const wchar_t [9]' to 'LPWSTR'

 

首先我們先看到這次的錯誤,嗯嗯嗯就是字串問題,其實C++,MFC,win32比其他語言麻煩的原因(我自己覺得拉),就是類型太多,其他的語言例如java,python…算了,先解決問題好了。

我們看到的問題是類型錯誤,所以我看到的第一個反應就是更改類型。

image

 

 

 

<方法 一>

Project->Property->General->Character Set->Use Unicode Character Set

image

 

<方法 二>

Project->Property->C/C++->Language->Conformance mode->No

image

 

我本人是到這個步驟就可以了,但如果你還是不行,我還是提供方法三給你參考。

 

 

 

<方法 三>

 Include InventorUtils.h

The exact error will be:

Severity Code Description File
Error C2664 'LPOLESTR T2OLE(LPTSTR)': cannot convert argument 1 from 'const wchar_t [16]' to 'LPTSTR' c:\users\public\documents\autodesk\inventor 2020\sdk\developertools\include\dispatchutils.h

The solution is to turn off the Conformance mode

 

 

arrow
arrow

    Eric 發表在 痞客邦 留言(0) 人氣()