#include <iostream>
#include <windows.h>
using namespace std;
int main ( int argc, char ^argv[])
{
MessageBox(NULL "hello world \nThis is the 2nd line." "hello" MB_OKYESCANCEL);
cin.get();
return 0;
}
i cant seem to get it to work
errors that i recieve
6 27 C:\Users\Josh\Desktop\C++\DialogBox.cpp [Error] expected ',' or '...' before '^' token
6 5 C:\Users\Josh\Desktop\C++\DialogBox.cpp [Warning] second argument of 'int main(int, char)' should be 'char **' [-Wmain]
C:\Users\Josh\Desktop\C++\DialogBox.cpp In function 'int main(int, char)':
8 18 C:\Users\Josh\Desktop\C++\DialogBox.cpp [Error] expected ')' before string constant
8 69 C:\Users\Josh\Desktop\C++\DialogBox.cpp [Error] too few arguments to function 'int MessageBoxA(HWND, LPCSTR, LPCSTR, UINT)'
72 0 c:\program files (x86)\dev-cpp\mingw64\x86_64-w64-mingw32\include\windows.h In file included from c:\program files (x86)\dev-cpp\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.7.1/../../../../x86_64-w64-mingw32/include/windows.h
2 C:\Users\Josh\Desktop\C++\DialogBox.cpp from C:\Users\Josh\Desktop\C++\DialogBox.cpp
3013 25 c:\program files (x86)\dev-cpp\mingw64\x86_64-w64-mingw32\include\winuser.h [Note] declared here
You are trying to compile CLI/C++ code in C++ compiler.
CLI/C++ is different language from C++, althrough it looks similar to it.
Also you have missed commas in function call
Try:
1 2 3 4 5 6 7 8 9
#include <iostream>
#include <windows.h>
usingnamespace std;
int main ( int argc, char* argv[])
{
MessageBox(NULL,"hello world \nThis is the 2nd line.","hello", MB_OKYESCANCEL);
cin.get();
}