"Cant find main" linking fortran with c++

This is a discussion on "Cant find main" linking fortran with c++ within the C Programming forums, part of the General Programming Boards category; I am trying to call a C routine (which uses C++ libraries) from a Fortran main program. To deal with ...

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    5

    Question "Cant find main" linking fortran with c++

    I am trying to call a C routine (which uses C++ libraries) from a Fortran main program. To deal with the name mangling i need to link with a c++ linker. I've done this before, and it worked. But now I keep getting told "Cannot find main". Can't work out what I'm doing differently to before. Can anyone help?


  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,437
    How about a clue as to which compiler set you're using?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Mar 2004
    Posts
    5
    The fortran routines were compiled with Intel8 (ifort) compiler. And I am trying to link with g++. The only difference before when it worked was I was using Intel 7 instead of 8.

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,437
    Well that sure is gonna make it tough.
    It's hard enough when all the tools come from the same place, then at least there is a change that naming and calling conventions are consistent.

    Ever thought of using the G77 Fortran compiler from GNU?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  5. #5
    Registered User
    Join Date
    Mar 2004
    Posts
    5
    I may try that to see if it works. In the long term I will need to use the Intel8 for speed.

  6. #6
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,437
    My other suggestion would be to use the 'nm' tool to explore the symbol names which are inside the various object files produced.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  7. #7
    Been here, done that.
    Join Date
    May 2003
    Posts
    1,157
    Try making a C main() and converting your Fortran program into a function.
    Definition: Politics -- Latin, from
    poly meaning many and
    tics meaning blood sucking parasites
    -- Tom Smothers

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem building Quake source
    By Silvercord in forum Game Programming
    Replies: 16
    Last Post: 07-11-2010, 09:13 AM
  2. Replies: 5
    Last Post: 04-16-2004, 01:29 AM
  3. linked list recursive function spaghetti
    By ... in forum C++ Programming
    Replies: 4
    Last Post: 09-02-2003, 02:53 PM
  4. Linking Fortran procedures with C program
    By gest in forum C Programming
    Replies: 5
    Last Post: 07-14-2003, 12:35 PM
  5. Won't Return pointer, i can't find why...
    By ss3x in forum C++ Programming
    Replies: 2
    Last Post: 02-28-2002, 07:50 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21