Compilation error

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

Compilation error

leo_yasir
Hello all!

I m compiling a file. The scenario is as follows
i m compiling following files as gcc -c option to get .o file.

emf_sock_lib_handler.c ha_cmd_handler.c HandleSJBA.c list_handler.c recv_and_reassembler.c scheduling_handler.c

These all files include my header file emf.h which in turn includes my header file vm.h file. In vm.h header file i have my functions defined. There complete procedure is in this file. After compiling these file, by using these .o files i want to compile another file emf_client.c, which also includes emf.h. when i compile this, it will give lots of errors saying that all the functions of vm.h are declared multiple times. the command which i m using is as follows

gcc -I .\include -I .\libatomic_ops\src -I "C:\Program Files\GnuWin32\include" -o emf_client emf_client.c emf_sock_lib_handler.o ha_cmd_handler.o HandleSJBA.o list_handler.o recv_and_reassembler.o scheduling_handler.o -s libgc.a WS2_32.Lib -s libssl.a -s libcrypto.a IPHlpApi.Lib

can anyone tells me wot is wrong with my compilation procedure or wot is the actual problem and how to solve that? waiting for reply
--
Yasir Majeed
Ph.D scholar
Center of Research in Networks and Telecommunication (CoReNeT)
www.corenet.org.pk
Mohammad Ali Jinnah University Islamabad, Pakistan
+923335935382

------------------------------------------------------------------------------

_______________________________________________
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: Compilation error

Greg Chicares
On 2010-04-21 10:27Z, Yasir Majeed wrote:
[...]
> These all files include my header file emf.h which in turn includes my
> header file vm.h file. In vm.h header file i have my functions defined.
> There complete procedure is in this file. After compiling these file, by
> using these .o files i want to compile another file emf_client.c, which also
> includes emf.h. when i compile this, it will give lots of errors saying that
> all the functions of vm.h are declared multiple times. the command which i m
> using is as follows

I think you're saying you have something like this:

  void foo(void) {return;} /* This is a definition. */

in a header file. Usually one would write only a declaration:

  void foo(void);

in a '.h' file, and the implementation in exactly one '.c' file.

Alternatively, if inline substitution is desired for performance
reasons, write it with 'inline' in the header:

  inline void foo(void) {return;} /* This is a inline definition. */

------------------------------------------------------------------------------
_______________________________________________
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: Compilation error

leo_yasir
yes u r right, i have defined functions in header file, and there is no .c file for this header file. So can u tell me how to remove that error???
On Wed, Apr 21, 2010 at 4:10 PM, Greg Chicares <[hidden email]> wrote:
On 2010-04-21 10:27Z, Yasir Majeed wrote:
[...]
> These all files include my header file emf.h which in turn includes my
> header file vm.h file. In vm.h header file i have my functions defined.
> There complete procedure is in this file. After compiling these file, by
> using these .o files i want to compile another file emf_client.c, which also
> includes emf.h. when i compile this, it will give lots of errors saying that
> all the functions of vm.h are declared multiple times. the command which i m
> using is as follows

I think you're saying you have something like this:

 void foo(void) {return;} /* This is a definition. */

in a header file. Usually one would write only a declaration:

 void foo(void);

in a '.h' file, and the implementation in exactly one '.c' file.

Alternatively, if inline substitution is desired for performance
reasons, write it with 'inline' in the header:

 inline void foo(void) {return;} /* This is a inline definition. */

------------------------------------------------------------------------------
_______________________________________________
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

------------------------------------------------------------------------------

_______________________________________________
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: Compilation error

Tor Lillqvist
> yes u r right,

If you want people to take you seriously, please write in complete
words with proper capitalisation and avoid "txtspk".

>  i have defined functions in header file, and there is no .c  file for this header file. So can u tell me how to remove that error???

Hint: #ifdef.

There are millions of examples of how to make the contents of a header
is seen only once by a compiler. Have you never looked at any header
files from some other software before?

--tml

------------------------------------------------------------------------------
_______________________________________________
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: Compilation error

leo_yasir
well thanks for the help, i have solved the problem. Thanks alot

On Wed, Apr 21, 2010 at 4:41 PM, Tor Lillqvist <[hidden email]> wrote:
> yes u r right,

If you want people to take you seriously, please write in complete
words with proper capitalisation and avoid "txtspk".

>  i have defined functions in header file, and there is no .c  file for this header file. So can u tell me how to remove that error???

Hint: #ifdef.

There are millions of examples of how to make the contents of a header
is seen only once by a compiler. Have you never looked at any header
files from some other software before?

--tml

------------------------------------------------------------------------------
_______________________________________________
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

------------------------------------------------------------------------------

_______________________________________________
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