Other than header file what do you need to use the functions defined in header
I have a myheader.h file, i have included it successfully in my VC++ project, but i am not able to use any of it functions. It gives the error Unresolve开发者_如何学God external symbol (my function definition). What am i missing?
//Here is my code snippet
#include "myHeaders/myheader.h"
void main (){
head_gen();
}
It doesnt build and the error is
Unresolved external symbol void__head_gen()
etc. Has it something to do with .lib file or something else?
You need the implementation of the function head_gen()
. This can be in
- a source file,
- an object file or
- a library
You should have one of them gotten with the header file.
If you have a .cpp file, add it to your project.
If you have a .obj or .lib file, add it as dependecy in the Project Properties:
Configuration Properties / Linker / Input -> Additional Dependencies
If the .obj or .lib file is in a different directory than your project, don't forget to add the path:
Configuration Properties / Linker / General -> Additional Library Directories
I develop mostly on Linux and use vi as an editor. But when I see such errors, it usually is one of the following reasons:
- The function
head_gen()
is defined under anamespace
and the source code wherehead_gen()
is used does not have theusing namespace
statement. - Has
head_gen()
been defined inmyHeader.cpp
? That could be another reason why the function is not "visible".
HTH,
Sriram
精彩评论