News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Why can't I define a NativeParser object?

Started by bruce, April 07, 2012, 04:27:22 AM

Previous topic - Next topic

bruce

I'd like define a NativeParser object to help me to parse a specific file and get the information I need. But the compiler tells me that my definition has something wrong.I am confused.
    The code of the key part is as follows.


#include "G:\codeblocks-10.05-release\src\plugins\codecompletion\nativeparser.h"
void myHello::OnMyHello(wxCommandEvent &event)
{
    LogManager* lm = Manager::Get()->GetLogManager();
    NativeParser np;

    Parser *par = np.GetParserPtr();
    par->Parse(_("E:\\PolynomialProblem(HDOJ).cpp")); //I want to use the parser to parse the specific file.

    //to process the parsing results;
    TokensTree * tt = par->GetTokens();
    for(int i=0; i<tt->size(); ++i)
    {
    Token* t = tt->at(i);
    lm->Log(t->m_Name); //to output the useful information to the CB.
    }
}


And the compiler logs are as follows.

Compiling: myHello.cpp
Linking dynamic library: myHello.dll
.objs\myHello.o:E:/C盘/hello/myHello.cpp:177: undefined reference to `NativeParser::NativeParser()'
.objs\myHello.o:E:/C盘/hello/myHello.cpp:180: undefined reference to `Parser::Parse(wxString const&, bool, LoaderBase*)'
.objs\myHello.o:E:/C盘/hello/myHello.cpp:183: undefined reference to `TokensTree::size()'
.objs\myHello.o:E:/C盘/hello/myHello.cpp:187: undefined reference to `NativeParser::~NativeParser()'
.objs\myHello.o:E:/C盘/hello/myHello.cpp:187: undefined reference to `NativeParser::~NativeParser()'
.objs\myHello.o:G:/codeblocks-10.05-release/src/plugins/codecompletion/parser/token.h:156: undefined reference to `TokensTree::GetTokenAt(int)'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 4 seconds)
6 errors, 0 warnings


    I have read the source files of the codecompletion plugin for some time. Maybe I didn't master this classes well. I need your suggestions. ???

ollydbg

1,
Quoteundefined reference to `NativeParser::NativeParser()'
You should have some cpp file in your project, like nativeparser.cpp.
BTW: I can try to see parser test project as a reference.
/src/plugins/codecompletion/parser/parsertest.cbp

2, Chinese chars in your path may cause some compiler error. So I suggest avoid this.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

oBFusCATed

bruce:
Keep in mind that this code is not part of the public SDK and might change without notice.
The code for the plublic SDK is in src/include and src/sdk/.
All the other code is privet in regard to plugin writers.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]