c2664

error C2664 and C2597 in OpenGL and DevIL in C++

↘锁芯ラ 提交于 2019-12-13 05:13:38
问题 I guess this is a two part problem, which is why I couldn't find a more suitable title for the post. I am loading an image using DevIL and then converting it to a familiar format. Here is the part of my code I am having troubles with: //Copy to OpenGL texture if(!ilConvertImage(IL_RGBA, IL_UNSIGNED_BYTE)) { throw runtime_error(std::string("Unable to convert image") +filename +std::string(" to display friendly format")); } glGenTextures(1, &Main::texture); glBindTexture(GL_TEXTURE_2D, Main:

C++ visual studio error C2664

≡放荡痞女 提交于 2019-12-12 04:16:14
问题 When I use this code if (GetKeyNameText(Key << 16, NameBuffer, 127)) { KeyName = NameBuffer; GoodKeyName = true; } I get the following error C2664 'int GetKeyNameTextW(LONG,LPWSTR,int)': cannot convert argument 2 from 'char [128]' to 'LPWSTR' The NameBuffer says this: Error: argument of type "char*" is incompatible with parameter of type "LPWSTR" Any tips? 回答1: You have UNICODE defined, which means all your functions and TCHAR and LPTSTR are defaulting to wide characters ( wchar_t ). That

Converting 'const char*' to 'LPCTSTR' for CreateDirectory

微笑、不失礼 提交于 2019-12-10 11:27:00
问题 #include "stdafx.h" #include <string> #include <windows.h> using namespace std; int main() { string FilePath = "C:\\Documents and Settings\\whatever"; CreateDirectory(FilePath, NULL); return 0; } Error: error C2664: 'CreateDirectory' : cannot convert parameter 1 from 'const char *' to 'LPCTSTR' How do I make this conversion? The next step is to set today's date as a string or char and concatenate it with the filepath. Will this change how I do step 1? I am terrible at data types and

Converting 'const char*' to 'LPCTSTR' for CreateDirectory

我的梦境 提交于 2019-12-06 13:05:36
#include "stdafx.h" #include <string> #include <windows.h> using namespace std; int main() { string FilePath = "C:\\Documents and Settings\\whatever"; CreateDirectory(FilePath, NULL); return 0; } Error: error C2664: 'CreateDirectory' : cannot convert parameter 1 from 'const char *' to 'LPCTSTR' How do I make this conversion? The next step is to set today's date as a string or char and concatenate it with the filepath. Will this change how I do step 1? I am terrible at data types and conversions, is there a good explanation for 5 year olds out there? std::string is a class that holds char

Errors C2664 and E0167, stumped

谁说我不能喝 提交于 2019-12-04 04:16:45
问题 I'm taking a c++ beginner's distance class and can't solve this compile error. It's written exactly as in the example book, and when my brother cuts and pastes it into his VS2015 it works fine, but in my VS2017 it doesn't. I have uninstalled and re-installed VS2017 community to no avail. I have only been coding for 2 weeks so I'm very, very new to this. The error codes I get are: Error E0167 argument of type "const char " is incompatible with parameter of type "char Error C2664 'void Hello

Errors C2664 and E0167, stumped

▼魔方 西西 提交于 2019-12-02 01:51:23
I'm taking a c++ beginner's distance class and can't solve this compile error. It's written exactly as in the example book, and when my brother cuts and pastes it into his VS2015 it works fine, but in my VS2017 it doesn't. I have uninstalled and re-installed VS2017 community to no avail. I have only been coding for 2 weeks so I'm very, very new to this. The error codes I get are: Error E0167 argument of type "const char " is incompatible with parameter of type "char Error C2664 'void Hello(char )': cannot convert argument 1 from 'const char [8]' to 'char ' The code: // FUNCTION: Hello, prints