mingw compilation error

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

mingw compilation error

leo_yasir
Hello all!

I m using mingw gcc to compile my program. I have included iphlpapi.h and iphlpapi.lib is placed in the same folder. I have setuped Visual studio 2008 c environment using vcvars32 command. Header file successfully included so no header file error .i m compiling this with the following command

gcc -c -I "C:\Program Files\GnuWin32\include" -liphlpapi -luser32 -lws2_32 emf_sock_lib_handler.c ha_cmd_handler.c HandleSJBA.c list_handler.c recv_and_reassembler.c scheduling_handler.c

All .c files include emf.h file which includes vm.h file, which contain this code. emf.h and vm.h are mine files. The error is given below the code

                PIP_ADAPTER_INFO pAdapterInfo;

                PIP_ADAPTER_INFO pAdapter = NULL;

                DWORD dwRetVal = 0;

                int my_flag = 0,my_flag1 = 0;



                DWORD dwSize = 0;

                DWORD dwRetVal1 = 0;



                //unsigned int i = 0;

                int counter = 0;



                // Set the flags to pass to GetAdaptersAddresses

                ULONG flags = GAA_FLAG_INCLUDE_PREFIX;



                // Initialize IP_ADAPTER_ADDRESSES structure members

                ULONG family = AF_UNSPEC;

                LPVOID lpMsgBuf = NULL;

                PIP_ADAPTER_ADDRESSES pAddresses = NULL;

                ULONG outBufLen = 0;

                ULONG Iterations = 0;

                PIP_ADAPTER_ADDRESSES pCurrAddresses = NULL;

                PIP_ADAPTER_UNICAST_ADDRESS pUnicast = NULL;

                PIP_ADAPTER_ANYCAST_ADDRESS pAnycast = NULL;

                PIP_ADAPTER_MULTICAST_ADDRESS pMulticast = NULL;

                IP_ADAPTER_DNS_SERVER_ADDRESS *pDnServer = NULL;

                IP_ADAPTER_PREFIX *pPrefix = NULL;

                ULONG ulOutBufLen = sizeof (IP_ADAPTER_INFO);

                //Get Adapters information through GetAdaptersAddresses function

                family = AF_INET;

                outBufLen = WORKING_BUFFER_SIZE;

                /*for(int j=0;j<20;j++)

                {

                        my_adapters[j].type = NULL;

                        /*memset(adapters[j].interfaceName,'\0',100);

                        memset(adapters[j].IP,'\0',100);

                        adapters[j].up = NULL;

                        adapters[j].running = NULL;

                }*/

                do

                {

                        pAddresses = (IP_ADAPTER_ADDRESSES *) MALLOC(outBufLen);

                        if (pAddresses == NULL)

                        {

                                printf("Memory allocation failed for IP_ADAPTER_ADDRESSES struct\n");

                                exit(1);

                        }

                        dwRetVal = GetAdaptersAddresses(family, flags, NULL, pAddresses, &outBufLen);

                        if (dwRetVal == ERROR_BUFFER_OVERFLOW)

                        {

                                FREE(pAddresses);

                                pAddresses = NULL;

                        }

                        else

                        {

                                break;

                        }

                        Iterations++;

                } while ((dwRetVal == ERROR_BUFFER_OVERFLOW) && (Iterations < MAX_TRIES));



                if (dwRetVal != NO_ERROR)

                {

                        printf("Error: Cannot retrieve adapters");

                        return 0;

                }



                pAdapterInfo = (IP_ADAPTER_INFO *) MALLOC(sizeof (IP_ADAPTER_INFO));

                if (pAdapterInfo == NULL) {

                        printf("Error allocating memory needed to call GetAdaptersinfo\n");

                        exit(0);

                }


Error
============

In file included from emf.h:35,
                 from emf_sock_lib_handler.c:2:
vm.h: In function `vm_interface_info':
vm.h:316: error: `GAA_FLAG_INCLUDE_PREFIX' undeclared (first use in this functio
n)
vm.h:316: error: (Each undeclared identifier is reported only once
vm.h:316: error: for each function it appears in.)
vm.h:321: error: `PIP_ADAPTER_ADDRESSES' undeclared (first use in this function)

vm.h:321: error: syntax error before "pAddresses"
vm.h:324: error: syntax error before "pCurrAddresses"
vm.h:325: error: `PIP_ADAPTER_UNICAST_ADDRESS' undeclared (first use in this fun
ction)
vm.h:326: error: `PIP_ADAPTER_ANYCAST_ADDRESS' undeclared (first use in this fun
ction)
vm.h:327: error: `PIP_ADAPTER_MULTICAST_ADDRESS' undeclared (first use in this f
unction)
vm.h:328: error: `IP_ADAPTER_DNS_SERVER_ADDRESS' undeclared (first use in this f
unction)
vm.h:328: error: `pDnServer' undeclared (first use in this function)
vm.h:329: error: `IP_ADAPTER_PREFIX' undeclared (first use in this function)
vm.h:329: error: `pPrefix' undeclared (first use in this function)
vm.h:344: error: `pAddresses' undeclared (first use in this function)
vm.h:344: error: `IP_ADAPTER_ADDRESSES' undeclared (first use in this function)
vm.h:344: error: syntax error before ')' token
vm.h:433: error: `pCurrAddresses' undeclared (first use in this function)




Please help me solving this error. I have tried many ways but in vain. Waiting for ur reply
Reply | Threaded
Open this post in threaded view
|

Re: mingw compilation error

Tuomo Latto
leo_yasir wrote:
> I m using mingw gcc to compile my program. I have included iphlpapi.h and
> iphlpapi.lib is placed in the same folder. I have setuped Visual studio 2008
> c environment using vcvars32 command. Header file successfully included so
> no header file error .i m compiling this with the following command
>
> gcc -c -I "C:\Program Files\GnuWin32\include" -liphlpapi -luser32 -lws2_32
> emf_sock_lib_handler.c ha_cmd_handler.c HandleSJBA.c list_handler.c
> recv_and_reassembler.c scheduling_handler.c
[...]
> Please help me solving this error. I have tried many ways but in vain.
> Waiting for ur reply

http://www.mingw.org/wiki/Specify_the_libraries_for_the_linker_to_use
http://www.mingw.org/wiki/FAQ


--
Tuomo

... Have an adequate day


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: mingw compilation error

leo_yasir
Well i have tried already all this, but my error is not solved. Please guide me with something else.......

On Sat, Apr 17, 2010 at 1:36 AM, Tuomo Latto <[hidden email]> wrote:
leo_yasir wrote:
> I m using mingw gcc to compile my program. I have included iphlpapi.h and
> iphlpapi.lib is placed in the same folder. I have setuped Visual studio 2008
> c environment using vcvars32 command. Header file successfully included so
> no header file error .i m compiling this with the following command
>
> gcc -c -I "C:\Program Files\GnuWin32\include" -liphlpapi -luser32 -lws2_32
> emf_sock_lib_handler.c ha_cmd_handler.c HandleSJBA.c list_handler.c
> recv_and_reassembler.c scheduling_handler.c
[...]
> Please help me solving this error. I have tried many ways but in vain.
> Waiting for ur reply

http://www.mingw.org/wiki/Specify_the_libraries_for_the_linker_to_use
http://www.mingw.org/wiki/FAQ


--
Tuomo

... Have an adequate day


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users



--
Yasir Majeed
Ph.D scholar
Center of Research in Networks and Telecommunication (CoReNeT)
www.corenet.org.pk
Mohammad Ali Jinnah University Islamabad, Pakistan
+923335935382

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: mingw compilation error

Tor Lillqvist
In reply to this post by leo_yasir
If you have a look inside the iphlpapi.h header included with MinGW,
you will notice that at least some of the identifiers you try to use
are surrounded by #if (_WIN32_WINNT >= 0x0501) . Thus you need to do
define _WIN32_WINNT as 0x0501 before including the headers in
question. Either with a #define or on the command line with -D. This
means that the resulting code won't run on anything older than Windows
XP I guess.

--tml

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: mingw compilation error

leo_yasir
Thanx alot dear. This solved my problem at last

On Mon, Apr 19, 2010 at 12:02 PM, Tor Lillqvist <[hidden email]> wrote:
If you have a look inside the iphlpapi.h header included with MinGW,
you will notice that at least some of the identifiers you try to use
are surrounded by #if (_WIN32_WINNT >= 0x0501) . Thus you need to do
define _WIN32_WINNT as 0x0501 before including the headers in
question. Either with a #define or on the command line with -D. This
means that the resulting code won't run on anything older than Windows
XP I guess.

--tml

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users



--
Yasir Majeed
Ph.D scholar
Center of Research in Networks and Telecommunication (CoReNeT)
www.corenet.org.pk
Mohammad Ali Jinnah University Islamabad, Pakistan
+923335935382

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users