[Win32] Visual Studio Win32 LNK2019 오류 해결

2023. 12. 28. 15:10·언어/C,C++

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로 바꿔주면 됐다. 

 

Project - (프로젝트 네임) Properties
Linker - System - SubSystem
CONSOLE -> WINDOWS

 

 

적용 후 다시 실행하니 Win32 창이 잘 만들어졌다.

 

첫 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

https://learn.microsoft.com/en-us/answers/questions/302271/when-compiling-the-example-from-msdn-the-following

 

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
'언어/C,C++' 카테고리의 다른 글
  • [C++] 컴파일 상수 constexpr
  • C language Chapter 7. 배열
  • C Language Chapter 6. 반복문
  • C language Chapter 5. C언어의 조건문(+switch문)
깜냥c
깜냥c
게임 개발/클라이언트/AI/PS/기타 연구
  • 깜냥c
    Choice Program
    깜냥c
  • 전체
    오늘
    어제
    • 분류 전체보기 (58)
      • 언어 (11)
        • C,C++ (9)
        • C# (1)
        • Python (1)
      • PS (20)
        • 백준 문제 (19)
        • 알고리즘 (1)
      • 인공지능 (2)
      • 게임제작 (7)
      • 게임개발 (15)
        • Unity (8)
        • Unreal Engine (5)
        • Godot Engine (1)
      • 기타 (2)
  • 블로그 메뉴

    • 홈
    • 방명록
    • 블로그 소개
  • 링크

    • 김병장의 IT 블로그
    • 식품영양과 데이터사이언스
  • 공지사항

  • 인기 글

  • 태그

    BOJ
    입출력
    unity
    백준
    C언어
    Godot
    배낭 문제
    C++
    UE5
    Unreal
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.3
깜냥c
[Win32] Visual Studio Win32 LNK2019 오류 해결
상단으로

티스토리툴바