Linker error
-
Hi all, i've played with/search for a solution and gotten frustrated over a problem that i have with a piece of code and i cant seem to get it down for some retarded reason. The error is this: error LNK2001: unresolved external symbol "int __cdecl brandom(int,int)" (?brandom@@YAHHH@Z) The code its talking about is
#include #include "header.h" using namespace std; int dport = brandom(1900, 48000); int main(){ int dport = brandom(1900, 48000); cout << dport << endl; return 0; } #ifndef __RANDOM_H__ // Contents of header.h #define __RANDOM_H__ void init_random(); int brandom(int client,int top); int get_random_number(int range); #endif
I've been to msdn about this stupid problem and yet i cant find out a way to resolve this. Can anyone help? Thanx in advance! -
Hi all, i've played with/search for a solution and gotten frustrated over a problem that i have with a piece of code and i cant seem to get it down for some retarded reason. The error is this: error LNK2001: unresolved external symbol "int __cdecl brandom(int,int)" (?brandom@@YAHHH@Z) The code its talking about is
#include #include "header.h" using namespace std; int dport = brandom(1900, 48000); int main(){ int dport = brandom(1900, 48000); cout << dport << endl; return 0; } #ifndef __RANDOM_H__ // Contents of header.h #define __RANDOM_H__ void init_random(); int brandom(int client,int top); int get_random_number(int range); #endif
I've been to msdn about this stupid problem and yet i cant find out a way to resolve this. Can anyone help? Thanx in advance! -
Hi all, i've played with/search for a solution and gotten frustrated over a problem that i have with a piece of code and i cant seem to get it down for some retarded reason. The error is this: error LNK2001: unresolved external symbol "int __cdecl brandom(int,int)" (?brandom@@YAHHH@Z) The code its talking about is
#include #include "header.h" using namespace std; int dport = brandom(1900, 48000); int main(){ int dport = brandom(1900, 48000); cout << dport << endl; return 0; } #ifndef __RANDOM_H__ // Contents of header.h #define __RANDOM_H__ void init_random(); int brandom(int client,int top); int get_random_number(int range); #endif
I've been to msdn about this stupid problem and yet i cant find out a way to resolve this. Can anyone help? Thanx in advance!The error message is clear: You have to link with the object (or the library) file containing the
brandom
function. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
[my articles] -
Nope If it was defined before, the header would have been skipped in the build of the relevant obj, and created a list of undefined symbol errors Regards,
Bram van Kampen
-
Nope If it was defined before, the header would have been skipped in the build of the relevant obj, and created a list of undefined symbol errors Regards,
Bram van Kampen
? If what he has written down is correct the only function that he is trying to use from that header file is the brandom one and precisely he is getting an unresolved external... Here I'm at 3:00 AM so I'm very tired, but it seems clear to me... EDIT: even if it is so late this is not excuse for not saying hello at the beginning and best regards at the end... sorry... :~
-
Hi all, i've played with/search for a solution and gotten frustrated over a problem that i have with a piece of code and i cant seem to get it down for some retarded reason. The error is this: error LNK2001: unresolved external symbol "int __cdecl brandom(int,int)" (?brandom@@YAHHH@Z) The code its talking about is
#include #include "header.h" using namespace std; int dport = brandom(1900, 48000); int main(){ int dport = brandom(1900, 48000); cout << dport << endl; return 0; } #ifndef __RANDOM_H__ // Contents of header.h #define __RANDOM_H__ void init_random(); int brandom(int client,int top); int get_random_number(int range); #endif
I've been to msdn about this stupid problem and yet i cant find out a way to resolve this. Can anyone help? Thanx in advance!There are plenty of things that could be going wrong here, but my first guess is your missing a reference to a library. If your function is from a .dll, and you have a .lib file for it, you can avoid path problems by putting them in your project directory along with the header file and include the appropriate pragma. If that eliminates the problem, then you know you had path issues and you can move the .lib file, .dll, and .h file to where you want, each time updating your path settings. #include "SomeLibrary.h" #pragma comment(lib, "SomeLibrary.lib")