Find the answer to your Linux question:
Results 1 to 4 of 4
Hi everyone, one of the most often posted questions on the web - but none seem to answer my problem. I am trying to compile with fortran (g95). Normal compiling ...
  1. #1
    Just Joined!
    Join Date
    Jan 2009
    Posts
    5

    [SOLVED] undefined reference to `MAIN_'

    Hi everyone,

    one of the most often posted questions on the web - but none seem to answer my problem.

    I am trying to compile with fortran (g95). Normal compiling works fine, preprocessing a .fpp doesn't. The following example shows that the b_message could be compiled no problem, but the b_system-linuxg95.fpp won't.

    -------
    Compiling module ./b_message (Rule 1)
    /opt/g95-install/bin/x86_64-suse-linux-gnu-g95 -c -freal-loops ./b_message.f
    ar: creating libinout-linuxg95.a
    a - b_message.o
    Pre-formatting module b_system
    gawk -f ./preform.awk -v os=linux -v cp=g95 b_system.fpp >b_system-linuxg95.fpp
    Preprocessing module b_system-linuxg95
    /opt/g95-install/bin/x86_64-suse-linux-gnu-g95 b_system-linuxg95.fpp >b_system-linuxg95.f
    /opt/g95-install/bin/../lib/gcc-lib/x86_64-suse-linux-gnu/4.0.3//libf95.a(main.o): In function `main':
    main.c.text+0xa): undefined reference to `MAIN_'
    make: *** [b_system-linuxg95.f] Fehler 1
    ------

    any help would be GREATLY appreciated!!!!!!

    cheers, sven

  2. #2
    Just Joined!
    Join Date
    Jan 2009
    Posts
    5
    Found the cause:

    Silly: I forgot the extra compiler option '-c' for the fpp. This allows subroutines to be compiled without a main program.

  3. #3
    Just Joined!
    Join Date
    Jan 2009
    Posts
    5
    - need to contradict myself: the compiling didn't work after all.
    No error was issued, but the resulting file is empty. So back to square one:

    can anyone help?

    thanks!
    Sven

  4. #4
    Just Joined!
    Join Date
    Jan 2009
    Posts
    5
    -E seems to work, but compilation still shows errors.

Posting Permissions

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