Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Help Please: unresolved external symbol

Author
Message
Freedom Fighters
14
Years of Service
User Offline
Joined: 2nd Nov 2009
Location:
Posted: 2nd Feb 2010 09:29
ok, i made two functions that do one of these two things, get a IpAddress and MacAddress.
i googled for help on creating these functions but now i got a problem which is they give me this problem:

these are in my Networking.cpp and been defined in a header which their class.

this is their code;


their defined


i have set code generation to /MT so i can make sense.
questions?
1 - what can i do to fix it
2 - why does this error

Problem Solution That Never Fails: "Build A Bridge And Get Over It"
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 2nd Feb 2010 19:12
Those error messages tell you that the function names gethostname and GetAdaptersInfo are not recognized by the compiler. Since these seem to be Windows API functions, try
and see if it helps. If not, then search among the headers in the Windows SDK to find in which header they are defined and include that.
Freedom Fighters
14
Years of Service
User Offline
Joined: 2nd Nov 2009
Location:
Posted: 2nd Feb 2010 21:19 Edited at: 2nd Feb 2010 21:23
i found the headers they where in and they where included already, i already have windows.h included.
ill post the two source code

EDIT: i attached the source for them

Problem Solution That Never Fails: "Build A Bridge And Get Over It"

Attachments

Login to view attachments
Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 2nd Feb 2010 22:58
gethostname is defined in <Winsock2.h>
GetAdaptersInfo is defined in <IPHlpApi.h>

and:



You are allocating memory and returning a pointer to it. Note that "delete [] Buffer;" will never be hit, since the function returns before it. This is exactly what DarkGDK does with dbStr, and will cause memory leaks and eventually cause the program to crash, unless the user of the class handles the memory correctly. I recommend doing what functions like sprintf do; pass a pointer to a buffer to the function, and modify it in the function, instead of returning allocated memory.

Your_Health = (My_Mood == HAPPY) ? 100 : NULL;
Freedom Fighters
14
Years of Service
User Offline
Joined: 2nd Nov 2009
Location:
Posted: 3rd Feb 2010 06:23
yer. ok,i changed winsock.h to winsock2.h

and i already defined GetAdaptersInfo from <IPHlpApi.h> <- i already had this in my include list.

and when i changes winsock.h to winsock2.h i get these errors.


yer, my StringIpAddress(char *IpPart1, char *IpPart2, char *IpPart3, char *IpPart4)
function ill fix later
trying to get the net functions working first

Problem Solution That Never Fails: "Build A Bridge And Get Over It"
bloodmage2
15
Years of Service
User Offline
Joined: 14th Jun 2009
Location:
Posted: 3rd Feb 2010 17:55
put include guards on everything you have. if you do not know what one is, its:

#ifndef <the file name in all caps, and _'s instead of spaces and .'s>
#define <the file name in all caps, and _'s instead of spaces and .'s>
<code here>

#endif

<>'s are not code, just an idea of what you put there.

this keeps multiple things from being included more than once, which, if you are including any file more than once, those errors will happen.

-to the optimist, the glass is half full. to the pessimist, it is half empty, to the engineer, it is twice as big as it needs to be.
Freedom Fighters
14
Years of Service
User Offline
Joined: 2nd Nov 2009
Location:
Posted: 3rd Feb 2010 21:36
can you give me an example please?

Problem Solution That Never Fails: "Build A Bridge And Get Over It"

Login to post a reply

Server time is: 2024-10-01 23:28:25
Your offset time is: 2024-10-01 23:28:25