|
STL 책을 보면서 예제를 치다가
cmath 를 include 했는데
#include <cmath>
transform(radians.begin(), radians.end(), sines.begin(), sin);
위 함수에서 sin 함수를 인자로 넘길 수 없다고 컴파일 에러가 나오더군요
그래서 살펴봤더니
cmath 의 내용이 아래처럼 되어 있었습니다
#define __USING_CNAME__
#include <math.h>
#undef __USING_CNAME__
그런데 다른 stl 헤더들은 다음과 같이 되어 있더군요
#ifdef _USE_OLD_RW_STL
# include <oldstl\iostream.h>
#else
# include <stlport\iostream>
/* Define __STD_IOSTREAM__ here to cause sysclass.h to define
VCL_IOSTREAM which causes certian iostream operators to get defined
*/
#define __STD_IOSTREAM__
#endif
#if !defined(__USING_STD_NAMES__) && defined(__cplusplus)
using namespace std;
#endif /* __USING_STD_NAMES__ */
그래서 위처럼 고쳐주었더니
#ifdef _USE_OLD_RW_STL
# include <oldstl\cmath.h>
#else
# include <stlport\cmath>
#endif
#if !defined(__USING_STD_NAMES__) && defined(__cplusplus)
using namespace std;
#endif /* __USING_STD_NAMES__ */
에러가 나지 않고 잘 되네요...
헤더를 고친게 잘한 짓인지 궁금해서 질문드립니다.. -_-;;
|