i cant find where is the error. Can someone help me, please

2001400009.obj : error LNK2001: unresolved external symbol "public: bool __thiscall Controller::Search(class std::basic_fstream<char,struct std::char_traits<char> > &,char * const,char * const)" ( Search@Controller@@QAE_NAAV $basic_fstream@DU $char_
Debug/2001400009.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
2001400009.exe - 2 error(s), 0 warning(s)

Re: Visual C++ Language link error. but i cant find the error

Holger Grund

Actually, the error message says it all:

You have declared and used the class member function bool Search( std::fstream& char, char* const, char*) member of class Controller.

What's odd about it is the top-level const qualifier: char * const instead of char const* or const char*. The former is a constant pointer to a modifyable object of type char. The latter two are equivalent and are modifyable pointers to a constant object of type char. Apparently, top-level const qualifiers contribute to the mangled name which actually sounds like a compiler bug (top level const on parameters are ignored for the function signature).

The first thing I'd do is check whether the reference to the symbol is expected (do you reference a function with that _exact signature_). If it is that a lock at the translation unit that you expect to provide the implementation. E.g. if the implementation of the function is in x.cpp take a look at dumpbin /SYMBOL x.obj. Is there a function Search If not, you may want to take a look at the preprocessed output of x.cpp.

How does the declaration of the member function look like Are there any differences in the macros passed to the compiler


Re: Visual C++ Language link error. but i cant find the error

Simple Samples

If you are also eugen_r2, then you wasted my time by posting this question in the other forum also. For the benefit of others, see strange error. If you are not the same person then it seems very unlikely that the other person is not someone you know. It would help if the two of you coordinate about the questions you two ask.

If the two user names are for the same person, please be aware that using two user names won't hide the fact that a question is asked more than once.

Re: Visual C++ Language link error. but i cant find the error


As stated above, this means that there is no definition of the member function Controller::Search. I'll presume that you actually have a definition.

Inlines and release/debug mistakes can cause things to disappear, e.g. #ifndef vs. #ifdef _DEBUG

The other place to look is at how headers are being interpreted. Especially with libraries, the headers will be processed twice:

once by the compiler when the library is compiled,
and a second time when the dependent application compiler processes the header files.

If the two projects have different compiler settings, then the headers can result in different meanings. For example the __thiscall. It is unlikely that you explicitly specified this. For native C++, __thiscall is default and added by the compiler. For pure CLR __clrcall is added by the compiler. If you built the library with one and the application with the other, then the linker would fail. Check the properties on two projects page by page and look for differences.

p.s. who names files 2001400009

Re: Visual C++ Language link error. but i cant find the error


i found the error. i forgot the header includes. thanx for the replies.