Change the character set to multi-byte.
Project properties -> general -> character set.
Or use a LPCWSTR instead of a const char..
the error is for both of the strings in the MessageBox:Code:// nigga.cpp : Defines the entry point for the application. // #include "stdafx.h" #include <Windows.h> using namespace std; int WINAPI _tWinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { MessageBox(NULL, "Sup Niggas!", "Note", MB_OK); return 0; }
argument of type "const char *" is incompatible with parameter of type "LPCWSTR" 11
I don't see any parameters with that name... js .
Change the character set to multi-byte.
Project properties -> general -> character set.
Or use a LPCWSTR instead of a const char..
MessageBox comes in two flavors.... MessageBoxA and MessageBoxW, the A stands for ASCII and the W stand for wide-char or Unicode. Hold your mouse over the MessageBox function and Intellisense should display MessageBoxW, this is because based on the settings of the compiler it uses MessageBoxW by default. I figured it would be better if you learn this now since almost all Windows API functions come in these two flavors, ASCII supporting the English typeset and Unicode supporting an international typeset including english characters. So either change your compiler settings or Use the MessageBoxA since it will support cstrings a.k.a. ASCII strings a.k.a. char*
"Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children. The cost of one modern heavy bomber is this: a modern brick school in more than 30 cities. It is two electric power plants, each serving a town of 60,000 population. It is two fine, fully equipped hospitals. It is some fifty miles of concrete pavement. We pay for a single fighter plane with a half million bushels of wheat. We pay for a single destroyer with new homes that could have housed more than 8,000 people. This is, I repeat, the best way of life to be found on the road the world has been taking. This is not a way of life at all, in any true sense. Under the cloud of threatening war, it is humanity hanging from a cross of iron."- Dwight D. Eisenhower
do this bro, and remember u using namespace std; with out the header file
#include <iostream> dont forget when ever u using namespace std; alway put this in
#include <iostream>
#include <Windows.h>
using namespace std;
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrvInstance,
LPSTR IpCmdLine,
int nShowCmd)
{
MessageBox(NULL, L"Sup Niggas!", L"Note", MB_OK);
return 0;
}
Last edited by bkbatman; 02-07-2011 at 12:15 AM.
Hell_Demon (02-07-2011)