기타
선언되지 않은 식별자입니다.
woongs_93
2022. 8. 4. 11:29
반응형
CInternetSession session(_T("session"));
session.SetOption(INTERNET_OPTION_CONNECT_TIMEOUT, 3000);
위와 같이 코드를 작성하였을 때 분명 session을 선언, 정의 하였지만
빌드 시,
error C2065: 'CInternetSession': 선언되지 않은 식별자입니다.
error C2146: 구문 오류: ';'이(가) 'session' 식별자 앞에 없습니다.
error C3861: 'session': 식별자를 찾을 수 없습니다.
오류를 던져버린다.
이유는 파일 상단에서 "pch.h" 보다 "afxinet.h" 헤더를 먼저 include 하였기 때문.
둘의 순서를 바꿔주면 해결된다.
// #include "afxinet.h"
// #include "pch.h"
#include "pch.h"
#include "afxinet.h"
반응형