multiple defination errors in makefile
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > multiple defination errors in makefile




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    multiple defination errors in makefile  
raju2000myin@gmail.com


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-20-07 12:22 PM

when i running a makefile it shows multiple defination errors.........
if the same code run with g++ compiler it gave correct results means
the functions in that header file is correctly linking but in writing
make file it shows errors like.............
g++ -o main_fwdDyn.x main_fwdDyn.o fwdDyn.o  -g -O2 -I.  -L../lib
fwdDyn.o(.text+0x0): In function `setmatrix(Matrix, double)':
/users/home/guest/ramesh/twotest/test/matrixfnc.h:11: multiple
definition of `setmatrix(Matrix, double)'
main_fwdDyn.o(.text+0x0):/users/home/guest/ramesh/test/matrixfnc.h:11:
first defined here
fwdDyn.o(.text+0x5c): In function `setelement(Matrix, int, int,
double)':
/users/home/guest/ramesh/twotest/test/matrixfnc.h:22: multiple
definition of `setelement(Matrix, int, int, double)'
main_fwdDyn.o(.text+0x5c):/users/home/guest/ramesh/test/matrixfnc.h:
22: first defined here
fwdDyn.o(.text+0x80): In function `mcalloc(int, int, double)':
/users/home/guest/ramesh/twotest/test/matrixfnc.h:28: multiple
definition of `mcalloc(int, int, double)'
main_fwdDyn.o(.text+0x80):/users/home/guest/ramesh/test/matrixfnc.h:
28: first defined here
fwdDyn.o(.text+0x11c): In function `setptr(Matrix*, double)':
/users/home/guest/ramesh/twotest/test/matrixfnc.h:42: multiple
definition of `setptr(Matrix*, double)'
main_fwdDyn.o(.text+0x11c):/users/home/guest/ramesh/test/matrixfnc.h:
42: first defined here
fwdDyn.o(.text+0x174): In function `ptrcalloc(int, int, int)':
/users/home/guest/ramesh/twotest/test/matrixfnc.h:54: multiple
definition of `ptrcalloc(int, int, int)'
main_fwdDyn.o(.text+0x174):/users/home/guest/ramesh/test/matrixfnc.h:
54: first defined here
fwdDyn.o(.text+0x238): In function `transpose(Matrix)':
/users/home/guest/ramesh/twotest/test/matrixfnc.h:75: multiple
definition of `transpose(Matrix)'
main_fwdDyn.o(.text+0x238):/users/home/guest/ramesh/test/matrixfnc.h:
75: first defined here
fwdDyn.o(.text+0x2e4): In function `operator+(Matrix, Matrix)':



please help me....... its urgent to me............






[ Post a follow-up to this message ]



    Re: multiple defination errors in makefile  
Maxim Yegorushkin


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-20-07 12:22 PM

On 20 Jun, 08:11, raju2000m...@gmail.com wrote:
> when i running a makefile it shows multiple defination errors.........
> if the same code run with g++ compiler it gave correct results means
> the functions in that header file is correctly linking but in writing
> make file it shows errors like.............
> g++ -o main_fwdDyn.x main_fwdDyn.o fwdDyn.o  -g -O2 -I.  -L../lib
> fwdDyn.o(.text+0x0): In function `setmatrix(Matrix, double)':
> /users/home/guest/ramesh/twotest/test/matrixfnc.h:11: multiple
> definition of `setmatrix(Matrix, double)'
> main_fwdDyn.o(.text+0x0):/users/home/guest/ramesh/test/matrixfnc.h:11:
> first defined here
> fwdDyn.o(.text+0x5c): In function `setelement(Matrix, int, int,
> double)':
> /users/home/guest/ramesh/twotest/test/matrixfnc.h:22: multiple
> definition of `setelement(Matrix, int, int, double)'
> main_fwdDyn.o(.text+0x5c):/users/home/guest/ramesh/test/matrixfnc.h:
> 22: first defined here
> fwdDyn.o(.text+0x80): In function `mcalloc(int, int, double)':
> /users/home/guest/ramesh/twotest/test/matrixfnc.h:28: multiple
> definition of `mcalloc(int, int, double)'
> main_fwdDyn.o(.text+0x80):/users/home/guest/ramesh/test/matrixfnc.h:
> 28: first defined here
> fwdDyn.o(.text+0x11c): In function `setptr(Matrix*, double)':
> /users/home/guest/ramesh/twotest/test/matrixfnc.h:42: multiple
> definition of `setptr(Matrix*, double)'
> main_fwdDyn.o(.text+0x11c):/users/home/guest/ramesh/test/matrixfnc.h:
> 42: first defined here
> fwdDyn.o(.text+0x174): In function `ptrcalloc(int, int, int)':
> /users/home/guest/ramesh/twotest/test/matrixfnc.h:54: multiple
> definition of `ptrcalloc(int, int, int)'
> main_fwdDyn.o(.text+0x174):/users/home/guest/ramesh/test/matrixfnc.h:
> 54: first defined here
> fwdDyn.o(.text+0x238): In function `transpose(Matrix)':
> /users/home/guest/ramesh/twotest/test/matrixfnc.h:75: multiple
> definition of `transpose(Matrix)'
> main_fwdDyn.o(.text+0x238):/users/home/guest/ramesh/test/matrixfnc.h:
> 75: first defined here
> fwdDyn.o(.text+0x2e4): In function `operator+(Matrix, Matrix)':
>
> please help me....... its urgent to me............

It probably means that you have function definitions in matrixfnc.h
which are not declared inline. This header gets included in sources
from which fwdDyn.o and main_fwdDyn.o are build. The compiler is
telling you that those functions exist in both of these .o.

Try declaring the multiple defined functions from matrixfnc.h inline.






[ Post a follow-up to this message ]



    Re: multiple defination errors in makefile  
Joachim Schmitz


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
06-20-07 12:22 PM

<raju2000myin@gmail.com> schrieb im Newsbeitrag
news:1182323464.335531.288900@i38g2000prf.googlegroups.com...
> when i running a makefile it shows multiple defination errors.........
> if the same code run with g++ compiler it gave correct results means
> the functions in that header file is correctly linking but in writing
> make file it shows errors like.............
> g++ -o main_fwdDyn.x main_fwdDyn.o fwdDyn.o  -g -O2 -I.  -L../lib
> fwdDyn.o(.text+0x0): In function `setmatrix(Matrix, double)':
> /users/home/guest/ramesh/twotest/test/matrixfnc.h:11: multiple
> definition of `setmatrix(Matrix, double)'
> main_fwdDyn.o(.text+0x0):/users/home/guest/ramesh/test/matrixfnc.h:11:
> first defined here
> fwdDyn.o(.text+0x5c): In function `setelement(Matrix, int, int,
> double)':
> /users/home/guest/ramesh/twotest/test/matrixfnc.h:22: multiple
> definition of `setelement(Matrix, int, int, double)'
> main_fwdDyn.o(.text+0x5c):/users/home/guest/ramesh/test/matrixfnc.h:
> 22: first defined here
> fwdDyn.o(.text+0x80): In function `mcalloc(int, int, double)':
> /users/home/guest/ramesh/twotest/test/matrixfnc.h:28: multiple
> definition of `mcalloc(int, int, double)'
> main_fwdDyn.o(.text+0x80):/users/home/guest/ramesh/test/matrixfnc.h:
> 28: first defined here
> fwdDyn.o(.text+0x11c): In function `setptr(Matrix*, double)':
> /users/home/guest/ramesh/twotest/test/matrixfnc.h:42: multiple
> definition of `setptr(Matrix*, double)'
> main_fwdDyn.o(.text+0x11c):/users/home/guest/ramesh/test/matrixfnc.h:
> 42: first defined here
> fwdDyn.o(.text+0x174): In function `ptrcalloc(int, int, int)':
> /users/home/guest/ramesh/twotest/test/matrixfnc.h:54: multiple
> definition of `ptrcalloc(int, int, int)'
> main_fwdDyn.o(.text+0x174):/users/home/guest/ramesh/test/matrixfnc.h:
> 54: first defined here
> fwdDyn.o(.text+0x238): In function `transpose(Matrix)':
> /users/home/guest/ramesh/twotest/test/matrixfnc.h:75: multiple
> definition of `transpose(Matrix)'
> main_fwdDyn.o(.text+0x238):/users/home/guest/ramesh/test/matrixfnc.h:
> 75: first defined here
> fwdDyn.o(.text+0x2e4): In function `operator+(Matrix, Matrix)':

Haven't you read Darko's reply to your earlier post?

Apparently (attention: guess work, as you haven't profided the code) some
funktions are defined (rather than declared) in your header file matrixfnc.h
If now main_fwdDyn.C _and_ fwdDyn.C (seems to be C++, right?) both #include
that header, both contain the code for that funktion and the Linker tells
you about the duplication.

Bye, Jojo







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 10:27 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register