[질문] c++ 에서 exturn "C" 가...

/* FILE valuesize.h
*/
#ifndef _VALUESIZE_H_
#define _VALUESIZE_H_
#ifdef __cplusplus
extern "C" {
#endif
int value_size(char *);
#ifdef __cplusplus
}
#endif
#endif
========================================
/* FILE valuesize.cpp
*/
#include
int value_size(char *value)
{
if ( !(strcmp ("size_t", value)) )
return sizeof(size_t);
return 0;
}
========================================
/* FILE main.cpp
*/
#include
#include "valuesize.h"
int main()
{
int a;
a = value_size("size_t");
printf("size_t 의 크기는 %d 입니다.\n", a);
return 0;
}
=========================================
g++ -g -Wall -c main.cpp
g++ -g -Wall -c valuesize.cpp
여기까지 정상입니다.
g++ -g -o valuesize main.o valuesize.o
여기서 에러 납니다. extern "C" 부분을
빼면 정상이더군요.
왜 이러죠?
Wowlinux 7.1 Paran
gcc-3.0.2
Re: [질문] c++ 에서 exturn "C" 가...
valuesize.cpp 에
#include "valuesize.h"
를 추가해주세요
댓글 달기