xerces class를 사용하는데요..static method사용 부분에서 에러
글쓴이: junteken / 작성시간: 화, 2004/05/04 - 10:06오전
일단 코드를 보자면 다음과 같습니다.
다음 15번 line에서 컴파일시 error가 납니다.
#include "/xerces/xerces-c-src_2_5_0/src/xercesc/parsers/XercesDOMParser.hpp" 2 #include "/xerces/xerces-c-src_2_5_0/src/xercesc/dom/DOM.hpp" 3 #include "/xerces/xerces-c-src_2_5_0/include/xercesc/sax/HandlerBase.hpp" 4 #include "/xerces/xerces-c-src_2_5_0/include/xercesc/util/XMLString.hpp" 5 #include "/xerces/xerces-c-src_2_5_0/include/xercesc/util/PlatformUtils.hpp" 6 #include <iostream> 7 8 9 10 using namespace std; 11 12 int main(void) 13 { 14 try{ 15 XMLPlatformUtils::Initialize(); 16 } 17 catch(const XMLException &toCatch){ 18 char *message= XMLString::transcode(toCatch.getMessage()); 19 cout<<"Error during initialization!:\n"<<message<<"\n"; 20 XMLString::release(&message); 21 return 1; 22 } 23 24 char *xmlFile= "GetPortsOfNode.xml"; 25 XercesDOMParser *parser= new XercesDOMParser(); 26 27 parser->setValidationScheme(XercesDOMParser::Val_Always); 28 parser->setDoNamespaces(true); 29 30 ErrorHandler *errHandler=(ErrorHandler*)new HandlerBase(); 31 parser->setErrorHandler(errHandler); 32 33 34 try{ 35 parser->parse(xmlFile); 36 } 37 catch(const XMLException &toCatch){ 38 char *message= XMLString::transcode(toCatch.getMessage()); 39 cout<<"EXception message is :\n"<<message<<"\n"; 40 XMLString::release(&message); 41 return -1; 42 } 43 catch(const SAXParserException &toCatch){ 44 char *message = XMLString::transcode(toCatch.getMessage()); 45 cout<<"Exception message is :\n"<<message<<"\n"; 46 XMLString::release(&message); 47 return -1; 48 } 49 catch(...){ 50 cout<<"Unexpected Exception \n"; 51 return -1; 52 } 53 54 delete parser; 55 delete errHandler; 56 return 0; 57 }
******에러메시지*************
test.cpp:15: error: `XMLPlatformUtils' undeclared (first use this function)
test.cpp:15: error: (Each undeclared identifier is reported only once for each
function it appears in.)
test.cpp:15: error: parse error before `::' token
*************************
헤더파일을 보면 분명 저 Initialize()가 static method로 선언이 되어있는데요...컴파일이 안되네요...ㅠ.ㅠ
누가 좀 도와주세욤...
Forums:
필요한 파일이 include되지 않아서 그렇습니다.사족이지만,
필요한 파일이 include되지 않아서 그렇습니다.
사족이지만,
테스트 하는게 아니시라면,
include를 절대 경로로 하지마시고 file name만 준다음
-I option으로 directory를 넘기시는 것이 좋습니다.
---
http://coolengineer.com
저기 한번만 더 봐주세요...
관리자님 말씀대로 -I옵션을 주어서 다음과 같은 소스로 테스트를 해보았습니다.
이것을 컴파일 하니깐 다음과 같은 컴파일 에러가 뜨네요...
**********에러 메시지***************
bash-2.05$ make in.o
g++ -c in.cpp -I/xerces/xerces-c-src_2_5_0/include
in.cpp: In function `int main()':
in.cpp:6: error: `XMLPlatformUtils' undeclared (first use this function)
in.cpp:6: error: (Each undeclared identifier is reported only once for each
function it appears in.)
in.cpp:6: error: parse error before `::' token
in.cpp:8: error: parse error before `&' token
make: *** [in.o] Error 1
************************************
크윽...어제 밤부터 계속 삽질입니다...ㅠ.ㅠ
XMLPlatformUtils 함수가 선언된 hpp를 include 하셔
XMLPlatformUtils 함수가 선언된 hpp를 include 하셔야하지요..
cd /xerces/xerces-c-src_2_5_0/include
grep -wr XMLPlatformUtils .
---
http://coolengineer.com
다시 물어서 죄송합니다만....PlatformUtils.hpp파일안에 보
다시 물어서 죄송합니다만....PlatformUtils.hpp파일안에 보면 XMLPlatformUtils 라는 class가 선언이 되어있습니다. 그리고 Initialize method도 static으로 선언이 되어있습니다...
어찌된 일일까용....ㅠ.ㅠ
-E 나 -save-temps option을 넣어 전처리한 결과를 한 번
-E 나 -save-temps option을 넣어 전처리한 결과를 한 번 분석해보세요.
-save-temps 는 .ii 파일이 만들어 집니다.
---
http://coolengineer.com
댓글 달기