Visual Studio에서 빈 프로젝트를 만들고 Win32 콘솔 창을 띄우기 위해 다음과 같이 코드를 작성했다.
#include <windows.h> // include the basic windows header file
// the entry point for any Windows program
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nShowCmd)
{
// create a "Hello World" message box using MessageBox()
MessageBox(NULL,
L"Hello World!",
L"Just another Hello World program!",
MB_ICONEXCLAMATION | MB_OK);
// return 0 to Windows
return 0;
}
그런데 빌드를 하니 아래처럼 LNK 2019 오류가 뜨며 실행이 안됐다.
나의 경우 해결 방법은 프로젝트 세팅에서 SubSystem을 CONSOLE에서 WINDOWS로 바꿔주면 됐다.
적용 후 다시 실행하니 Win32 창이 잘 만들어졌다.
위 방법이 안 통하면 밑에 참고 링크에서 다른 해결법들을 찾아볼 수 있다.
참고 링크
https://core9090.tistory.com/83
Visaul2017에서 win32콘솔창 만들기,LNk2019오류해결
Visaul2017은 win32콘솔기능은 visaul2012다르게 따로 나타나지 않게 해놨습니다. 업데이트 될때마다 유용하게 사용하던 기능이 안보이니 난감할때가 종종 있네요. 그럼 이번에는 visaul2017 C++사용하는
core9090.tistory.com
https://stackoverflow.com/questions/20917359/error-lnk2019-in-visual-studio-in-win32-application
Error LNK2019 in visual studio in win32 application?
I have making an attempt at writing my first program in Visual Studio, however am being troubled by an error. It says: - Error 3 error LNK2019: unresolved external symbol _wWinMain@16 referenc...
stackoverflow.com
When compiling the example from MSDN the following error has place: LNK2019 unresolved external symbol reference - Microsoft Q&A
Hi. I have a problem with creation of toolbar in Win32 C++ application. I want to reproduce an example from MSDN: https://learn.microsoft.com/en-us/windows/win32/controls/create-toolbars. Below is source code: HINSTANCE hInst; HIMAGELIST…
learn.microsoft.com
'언어 > C,C++' 카테고리의 다른 글
[C++] 컴파일 상수 constexpr (1) | 2024.08.10 |
---|---|
C language Chapter 7. 배열 (0) | 2022.10.09 |
C Language Chapter 6. 반복문 (0) | 2020.08.03 |
C language Chapter 5. C언어의 조건문(+switch문) (0) | 2020.04.17 |
C language Chapter 4. C언어의 입출력 (0) | 2020.03.17 |