Find the answer to your Linux question:
Results 1 to 9 of 9
I have problems with linking object files.This is what I get: mt2d.o: In function `MAIN__': fort77-15047-1.c .text+0x1e3): undefined reference to `boumedcell_' fort77-15047-1.c .text+0x3b9): undefined reference to `sflfld_' fort77-15047-1.c .text+0x3d2): undefined ...
  1. #1
    Just Joined!
    Join Date
    May 2010
    Posts
    41

    makefile flags

    I have problems with linking object files.This is what I get:
    mt2d.o: In function `MAIN__':
    fort77-15047-1.c.text+0x1e3): undefined reference to `boumedcell_'
    fort77-15047-1.c.text+0x3b9): undefined reference to `sflfld_'
    fort77-15047-1.c.text+0x3d2): undefined reference to `koef3rhs_'
    fort77-15047-1.c.text+0x445): undefined reference to `gaussrrhs_'
    Which flag should I use?
    I have tried with -fno-underscore but no use.
    F77=f77
    FFLAG= -O3 -fno-underscore
    Any suggestions?

  2. #2
    Just Joined!
    Join Date
    Jul 2008
    Posts
    81
    Quote Originally Posted by milosavpejic View Post
    I have problems with linking object files.This is what I get:
    mt2d.o: In function `MAIN__':
    fort77-15047-1.c.text+0x1e3): undefined reference to `boumedcell_'
    fort77-15047-1.c.text+0x3b9): undefined reference to `sflfld_'
    fort77-15047-1.c.text+0x3d2): undefined reference to `koef3rhs_'
    fort77-15047-1.c.text+0x445): undefined reference to `gaussrrhs_'
    Which flag should I use?
    I have tried with -fno-underscore but no use.
    F77=f77
    FFLAG= -O3 -fno-underscore
    Any suggestions?
    Is mt2d a program that you wrote yourself, or are you trying to compile someone else's source files?

    The initial appearance is that you have some undefined variables, either because they are mis-spelled or because there is a missing library which contains their definitions.

  3. #3
    Just Joined! wildpossum's Avatar
    Join Date
    Apr 2008
    Location
    Sydney/Australia
    Posts
    92
    You need to supply the complete gcc line - Why well you problem could be library based, not just command line option based. Hence if you want an answer you need to supply full details of what and how you doing things.

  4. #4
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    This is indicative that you are not linking in the library that contains/implements the functions/symbols named in the error output. You need to tell the fortran compiler to link to the required library in your Makefile. As to which it is, I have no clue - that's your job!
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  5. #5
    Just Joined!
    Join Date
    May 2010
    Posts
    41
    Well,the fact is I have used much part of the code from a collegue physicist.His code was working in windows I have remade it.
    boumedcell_,the underscore could be related to fortran compiler but how?

  6. #6
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    The underscore is added by the compiler - not a problem unless you compiled with different options than the original one did (assuming you got a binary of the libraries in question). If you got the source code, make sure you are using the same compiler and/or compatible options/flags.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  7. #7
    Just Joined!
    Join Date
    May 2010
    Posts
    41
    I have solved it.But now I get this:
    make: Circular boumedcell.o <- boumedcell.o dependency dropped.
    f77 -o mt mt.o indat.o re2.o defpol12.o boumedcell.o boufld.o koef3.o gaussr.o sflfld.o koef3rhs.o gaussrrhs.o surfce.o
    koef3rhs.o: In function `MAIN__':
    fort77-10987-1.c.text+0x0): multiple definition of `MAIN__'
    mt.o:fort77-10933-1.c.text+0x0): first defined here
    mt.o: In function `MAIN__':
    Why do I have multiple definiton of MAIN?

  8. #8
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Well, it seems two of the components of the build (mt.o, koef3rhs.o) have both have implemented main(). Fix that and I think you are golden.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  9. #9
    Just Joined!
    Join Date
    May 2010
    Posts
    41
    I have fix it.But:
    make: Circular boumedcell.o <- boumedcell.o dependency dropped.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...