ncurses와 iostream 사용시 발생하는 문제

sawa500의 이미지

#include <ncurses>
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <fstream>
#include <iomanip>
#include <cmath>
 
int main() {
 std::vector <int> vInt;
 vInt.clear();
 vInt.push_back(1);
 std::cout << "Hello World" << std::endl;
 return 0;
}

Mingw에서 작업하고 있습니다. ncurses를 이용해볼까해서 위 코드처럼 header를 링크하면

d:/Lab/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/basic_string.h:1039:54: macro "erase" passed 2 arguments, but takes just 0
d:/Lab/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/basic_string.h:1040: error: invalid member function declaration
d:/Lab/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/basic_string.h:1052:32: macro "erase" passed 1 arguments, but takes just 0
d:/Lab/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/basic_string.h:1053: error: invalid member function declaration
d:/Lab/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/basic_string.h:1072:46: macro "erase" passed 2 arguments, but takes just 0
d:/Lab/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/basic_string.h:1073: error: invalid member function declaration

와 같은 메시지를 내면서 컴파일이 안됩니다. 이거 어떻게 해결해야하는지 좀 알려주세요. namespace를 이용해야한다면 구체적으로 어디에 어떻게 사용해야하는지도 좀 부탁드립니다.
cppig1995의 이미지

ncurses에 erase라는 매크로가 정의되어 있고, basic_string::erase에서 erase를 매크로확장하려고 하는 것으로 보입니다.
일단 ncurses를 가장 아래로 빼 보세요.



한말글 프로그래밍 언어 "열정" http://me-lang.wo.tc

Real programmers /* don't */ comment their code.
If it was hard to write, it should be /* hard to */ read.

sawa500의 이미지

vInt.clear()라는 함수에서 문제가 발생합니다. ncurses 헤더파일을 보니 clear라는 매크로가 있던데 이게 문제인 것 같습니다. 아아, 골아프네요