-
linking problems
having trouble with my code when i build it, i get some linking errors i have no idea what they mean
as far as i know all the libary files that are needed are present for the project, its only WS2_32.LIB that i need anyway i think
Code:
mesagesend.obj : error LNK2001: unresolved external symbol "void __cdecl disconnectfromserver(int)" (?disconnectfromserver@@YAXH@Z)
mesagesend.obj : error LNK2001: unresolved external symbol "int __cdecl connecttoserver(unsigned short,char const *)" (?connecttoserver@@YAHGPBD@Z)
client___Win32_Debug/client.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.
any ideas anyone?
-
what is the compiler your using?
-
-
-
It can't find the functions you posted here
http://cboard.cprogramming.com/cplusplus-programming/60324-passing-function-problem.html
If you have multiple source files, you need to make sure that all your source files are in the project.
-
i have included all the header files i need in the main, and the .lib files i need
i can't see any i have missed
-
It's not enough to include a header file containing
[code// this is say connecting.h
]int connecting::connecttoserver(unsigned short port, const char *servername); // a prototype[/code]
you also need the source code as well.
Code:
// this is say connecting.cpp
int connecting::connecttoserver(unsigned short port, const char *servername) {
// body
}
The compiler needs the header file (via #include) in order to be able to call the function.
The linker (which generated those errors) needs the actual code. Actual code is found in the compiled objects of other source modules you wrote, other libraries you wrote or other libraries other people wrote.