1

I encounter a problem about LNK2019 when I compile my project with Visual Studio 2010. Can anyone help me? Thanks.

gspan.obj : error LNK2019: 無法解析的外部符號 "public: class std::vector,class std::allocator >,class std::allocator,class std::allocator > > > __thiscall gSpan::tokenize(class std::basic_string,class std::allocator >)" (?tokenize@gSpan@@QAE?AV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@3@@Z) 在函式 "private: void __thiscall gSpan::read(class std::basic_string,class std::allocator >)" (?read@gSpan@@AAEXV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) 中被參考

C:\Users\cool\documents\visual studio 2010\Projects\OGSPAN\Debug\OGSPAN.exe : fatal error LNK1120: 1 個無法解析的外部符號

2 Answers 2

1

Please check you source code, the method gSpan::tokenize is not implemented. It's called in gSpan::read. By the way, gSpan::is_min is not implemented too.

You can use dumpbin.exe to examine the generated gspan.obj. All other gSpan:: methods are defined in SECT??(where ?? is two hex digits I think) sections, While gSpan::tokenize and gSpan::is_min are UNDEF.

To recreate the error, use this code:

class a { public: void func1(void); void func2(void); }; void a::func1(void) { func2(); } int _tmain(int argc, _TCHAR* argv[]) { a b; b.func1(); return 0; } 
Sign up to request clarification or add additional context in comments.

1 Comment

I forget to implement tokenize in my code..., thanks for your help! Best :)
1

LNK2019 means that one of your object files is referring to a symbol (function or variable name) that isn't defined in any of them. Often it means that you declared and called a function, but forgot to actually implement the function.

2 Comments

If I'm reading that error correctly, it looks like it's the definition of void gSpan::read(std::string) that's missing.
Thanks for your help! You make me know the meaning of LNK2019! Best :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.