Linking issues - "redefined"

Started by
6 comments, last by pcxmac 17 years, 11 months ago
when ever I compile and include "winsock2.h" I get classes and structs which are redefined, If I uninclude the winsock2.h file, the functions of that header are undefined. would I be correct in assuming there is another winsock2.h file, but with out any functions somewhere in my link path? Its frustrating, because I am not including that file twice, and to boot If I dont include the winsock2.h file, the classes and structs dont return any errors even though I can't "find the reference" for them, maybe my linker looks for functions before classes, but still. ugh.
sig
Advertisement
What IDE are you using?

If VC++7 or above, try enabling "ShowIncludes" in the Advanced section of the project properties. That will show you which files are being included... natch.

If not, try searching for "winsock2.h" and search "Entire Solution" and/or all the include directories in your path. Find all the files where it is included, and see if you include THOSE headers.

...

It could also be that you are linking more than one static library where the symbols have been defined, and you have a linker error.

HTH


Chad
my_life:          nop          jmp my_life
[ Keep track of your TDD cycle using "The Death Star" ] [ Verge Video Editor Support Forums ] [ Principles of Verg-o-nomics ] [ "t00t-orials" ]
codewarrior 9.4 (updated)

I am thinking about going to VC++ 2005 EE :(
sig
as usual, show code [smile]

Beginner in Game Development?  Read here. And read here.

 

yeah... to Alpha_ProgDes you listen :)

...and maybe do a clean build. It's possible some .obj (.o) and .lib (.a) files contain the same symbols.
my_life:          nop          jmp my_life
[ Keep track of your TDD cycle using "The Death Star" ] [ Verge Video Editor Support Forums ] [ Principles of Verg-o-nomics ] [ "t00t-orials" ]
I have recompiled, rid my self of prior object code.

the code is quite simple, all I would have to do is

#include "winsock2.h"

~main~
{

anycall to a winsock function; /// errp function redefined.

}

error redefined - anycall

I have put this in an involved project, and a simple hello world program, same issues. Im quite put off with my linker right now.

Im almost certain its codewarrior specific. This is a conceptual problem, not a matter of syntax, and it has to do with my linker seeing double, where I have been only able to find one header file.

THIS IS A PROBLEM WITH SETTINGS AND LINKING ISSUES WITH CODEWARRIOR 9, not a code issue.
sig
Checking out these lines from winsock2.h...

#ifndef _WINSOCK2API_#define _WINSOCK2API_#define _WINSOCKAPI_   /* Prevent inclusion of winsock.h in windows.h */


...this suggests that maybe you're including <windows.h> before <winsock2.h>?

But I haven't looked through winsock2.h thoroughly... you may need <windows.h> first to define data types like DWORD and UINT.

[EDIT] woop ... look at this:

Lines 35-41:

/* * Pull in WINDOWS.H if necessary */#ifndef _INC_WINDOWS#include <windows.h>#endif /* _INC_WINDOWS */


Just do away with #include <windows.h>, if you have that in your header.
my_life:          nop          jmp my_life
[ Keep track of your TDD cycle using "The Death Star" ] [ Verge Video Editor Support Forums ] [ Principles of Verg-o-nomics ] [ "t00t-orials" ]
ill give it a shot, thanks.
sig

This topic is closed to new replies.

Advertisement