-1

I am trying to compiling a code with the MIB_IPINTERFACE_ROW structure. Let's include the following class in my working code:

class IpInterfaceRow {
private:
    MIB_IPINTERFACE_ROW mib_ipinterface_row;
};

Using Visual Studio 2015 I am facing the following errors: unknown override specifier (C3646) and missing type specifier - int assumed. Note: C++ does not support default-int (C4430)

That you can check here - C3646 and here - C4430. Really the second one is more a warning, that I could turn off with #pragma warning, and I think it depends on the first one (since the compiler does not recognize MIB_IPINTERFACE_ROW, it tries to give it the value of an int, hence the second error) then, I am focusing on the first one.

I think that maybe is a problem of headers that I include/not include in the wrong order? I tried a lot of options: #include <netioapi.h>, #include <iphlapi.h> and much more... For example, from here, I tried to use

#include <ws2def.h>
#include <ws2ipdef.h>
#include <iphlpapi.h>

but same result...I have the same problem if I try to use MIB_INTERFACE_TABLE. I also tried to compile the example code in GetIpInterfaceTable(), which has this includes

#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif

#include <windows.h>
#include <winsock2.h>
#include <ws2ipdef.h>
#include <iphlpapi.h>
#include <stdio.h>
#include <stdlib.h>

#pragma comment(lib, "iphlpapi.lib")

but again the same result...

Someone has an idea of what can be wrong? what does error C3646 could mean in my case?

n3mo
  • 663
  • 8
  • 23
  • 1
    The error message looks like unrelated to the shown snippets. Can you please report an exact copy of the error messages? What line number is addressed in the error message, please show that line. Since this is described as a simply reproducible problem please include a minimal, complete, and verifiable example (https://stackoverflow.com/help/mcve). – harper Jan 22 '18 at 13:58
  • Hi harper, thanks for pushing me to write a reproducible program...I did it, and it worked :O At the end I dug all the code, and I found in another file an include of iphlpapi.h...and this include came before ws2ipdef.h........that was the problem....Making iphlapi go after wsipdef solved the problem......if you want to write something in an answer i will accept it... – n3mo Jan 22 '18 at 16:06
  • It's okay to answer the question by yourself if you think it's worth for others to read it. The tags [SOLVED] or **Edit Solved** is not the common style at StackOverflow. – harper Jan 23 '18 at 15:11

1 Answers1

0

The following includes indeed work

#include <winsock2.h>
#include <windows.h>
#include <ws2ipdef.h>
#include <iphlpapi.h>
#include <stdio.h>
#include <stdlib.h>

#pragma comment(lib, "iphlpapi.lib")

In my code there were two files included before that gave me the problem:

  • The first included iphlpapi.h (then, included before ws2ipdef.h)

  • The second included netcfgx.h that includes windows.h (then included before winsock2.h)

In particular note that other headers i.e. in my case netcfgx.h can include some of the headers, i.e. windows.h and make the order wrong

n3mo
  • 663
  • 8
  • 23