-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Noobie errors! #4
Comments
I'm not sure what you need to do in *nix but for Visual Studio you need to change the compiler over to UNICODE. To do this you goto Project -> Properties -> General -> Character Set -> Use Unicode Character Set. Here is a link that talks about changing the character set for g++: |
I tried to compile this in CodeBlocks and it does not work. What do I do? |
I don't know how to compile this in cmd. Please tell me what to do. |
@Quake504 I tried the option posted here https://stackoverflow.com/questions/61880906/c-errorinvalid-conversion-from-int-to-const-wchar-t-because-of-swprintf Just add a W to the method: WriteConsoleOutputCharacter(...) -> WriteConsoleOutputCharacterW(...) and it must work when you try to compile it on Code Blocks. It worked for me ;) |
When I compiled the program this happened, please tell me what to do.
$ g++ -std=gnu++17 -o game CommandLineFPS.cpp
CommandLineFPS.cpp: In function 'int main()':
CommandLineFPS.cpp:267:114: error: 'swprintf_s' was not declared in this scope
swprintf_s(screen, 40, L"X=%3.2f, Y=%3.2f, A=%3.2f FPS=%3.2f ", fPlayerX, fPlayerY, fPlayerA, 1.0f/fElapsedTime);
^
CommandLineFPS.cpp:279:103: error: cannot convert 'wchar_t*' to 'LPCSTR {aka const char*}' for argument '2' to 'BOOL WriteConsoleOutputCharacterA(HANDLE, LPCSTR, DWORD, COORD, PDWORD)'
WriteConsoleOutputCharacter(hConsole, screen, nScreenWidth * nScreenHeight, { 0,0 }, &dwBytesWritten);
^
The text was updated successfully, but these errors were encountered: