본문 바로가기

분류대기

윈도우 컴파일 에러. [No Target Architecture]

[1. 개요]

윈도우 System api 를 사용해서, c++ application 소스 코드 작성 후, 

cmake 를 이용하여, 윈도우 visual studio 빌드 환경을 구축하였다.

 

컴파일을 진행 하니, Fatal error: "No Target Architecture" 가 발생하면서, 컴파일 실패함.


[2. 해결 방법]

여러가지 솔루션들이 있었으나, 나의 경우

#include <windows.h> 를 다른 윈도우 api header 보다 먼저 include 하는 것 이었다.

// Before
#include <processthreadsapi.h>
#include <iostream>
#include <windows.h> /*****/ 

// After
#include <windows.h> /*****/
#include <processthreadsapi.h>
#include <iostream>

 

그 외 부가적으로, 

  • CMAKE_GENERATOR_PLATFORM 를 x64 로 명시
  • WIN32_LEAN_AND_MEAN 매크로 정의

[3. ref]

https://stackoverflow.com/questions/4845198/fatal-error-no-target-architecture-in-visual-studio

 

'분류대기' 카테고리의 다른 글

Socket, 멀티 캐스트 & 브로드 캐스트  (0) 2025.03.09
Segmentation fault 해결 (C++)  (0) 2025.03.04
소켓 Linger 옵션  (0) 2025.02.26
[인코딩] EUCKR  (0) 2025.02.04
[인코딩] UTF-8  (0) 2025.01.23