Discussion:
C2065: Undeclared identifiers using iphlpapi.h
(too old to reply)
Grant
2006-04-26 18:44:58 UTC
Permalink
Hello all,

I am having an issue using iphlpapi.h with visual studio .net 2003 with
a console application.

I have checked that the files involved (header and lib) are in the
appropriate paths according to
Tools->Options->Projects->Directories.

When I try to compile it complains that PIP_ADAPTER_ADDRESSES,
IP_ADAPTER_ADRESSES, and GetAdaptersAddresses() are all undeclared
identifiers.

It doesn't complain about not finding the header file, iphlpapi.h, like
you would expect if my directories weren't correct. I've gone so far as
copying the header file into my project directory and making sure that
the items I am trying to use and I still get the C2065 Undecalred
identifier errors.

Has anyone run into this before and found a fix or have any
suggestions?
Igor Tandetnik
2006-04-26 18:55:39 UTC
Permalink
Post by Grant
I am having an issue using iphlpapi.h with visual studio .net 2003
with a console application.
I have checked that the files involved (header and lib) are in the
appropriate paths according to
Tools->Options->Projects->Directories.
When I try to compile it complains that PIP_ADAPTER_ADDRESSES,
IP_ADAPTER_ADRESSES, and GetAdaptersAddresses() are all undeclared
identifiers.
Include winsock2.h before iphlpapi.h
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
Grant
2006-04-26 22:01:24 UTC
Permalink
Thank you Igor - I no longer am getting Undeclared Identifiers for
items declared within iphlpapi.h, however I think I am not doing
something correctly in terms of the order of includes I use (I think).

If I include winsock2.h after windows.h I get lots of "redeclaration
errors" where winsock2.h must be changing the declarations of items in
winsock.h

If I include winsock2.h before windows.h I get a linkage error on the
function I am trying to call : LNK2019 : unresolved external symbol
***@20 referenced in function _main
Igor Tandetnik
2006-04-26 22:26:19 UTC
Permalink
Post by Grant
Thank you Igor - I no longer am getting Undeclared Identifiers for
items declared within iphlpapi.h, however I think I am not doing
something correctly in terms of the order of includes I use (I think).
If I include winsock2.h after windows.h I get lots of "redeclaration
errors" where winsock2.h must be changing the declarations of items in
winsock.h
If I include winsock2.h before windows.h I get a linkage error on the
function I am trying to call : LNK2019 : unresolved external symbol
The correct way is to include winsock2.h before windows.h. This is a
known problem with current Platform SDK.

The linker error is unrelated to the order of includes. You should add
Iphlpapi.lib to the list of modules you link against. In the IDE, that
would be Project | Properties | Linker | Input | Additional Dependencies
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
Loading...