- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is my problem below, if I have compiled my code by ifort, some errors has occurred. I don't know why for_main.o in /opt/intel/fce/9.0/lib/ make this kind of problems... However, main.f90 is made by me.
Could you let me know how to get a solution for my problem? Thanks.
[mycat@mycom dr]$ifort -O3 -tpp7 -Vaxlib -ip -o sm precision.o global.o global_param.o global_app.o main.o init.o
main.o(.text+0x0): In function `main':
: multiple definition of `main'
/opt/intel/fce/9.0/lib/for_main.o(.text+0x0): first defined here
ld: Warning: size of symbol `main' changed from 70 in /opt/intel/fce/9.0/lib/for_main.o to 4052 in main.o
ld: warning: i386 architecture of input file `precision.o' is incompatible with i386:x86-64 output
ld: warning: i386 architecture of input file `global.o' is incompatible with i386:x86-64 output
ld: warning: i386 architecture of input file `global_param.o' is incompatible with i386:x86-64 output
ld: warning: i386 architecture of input file `global_app.o' is incompatible with i386:x86-64 output
ld: warning: i386 architecture of input file `main.o' is incompatible with i386:x86-64 output
ld: warning: i386 architecture of input file `init.o' is incompatible with i386:x86-64 output
/opt/intel/fce/9.0/lib/for_main.o(.text+0x2e): In function `main':
: undefined reference to `MAIN__'
main.o(.text+0x17): In function `main':
: undefined reference to `f90_init'
main.o(.text+0x62): In function `main':
: undefined reference to `f_iof'
main.o(.text+0x82): In function `main':
: undefined reference to `f_iof'
main.o(.text+0xe2): In function `main':
: undefined reference to `f_iod'
main.o(.text+0xf8): In function `main':
: undefined reference to `f_iod'
............................ The same problems happens below this line....
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Could you show me your main.f program? Do you have something like:
program main
...
end program main
If you
nm /opt/intel/fce/9.0/lib/for_main.o
You'll see that 'main' is defined in for_main.o ( "T main ). It is an entry point in the startup routines that wrap and launch your user PROGRAM.
so do this for me:
nm main.o
and look for symbol "main". Is it in main.o as a Target "T main"?
ron
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
forgot to add: I would bet $20 that somewhere in your code you have declared a variable named 'main'. Again, 'main' is a special name that you cannot use in your program.
rename 'main' in your code.
ron
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your helps.
As Steve mentions, this problemscan have solved by removing 'main.o' file because this object file of the previousversionmade that and, after then, I have recompiled my code to link.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I sourced the ifortvars.sh, iccvars.shto change to the 32 bit compiler for ifort and C respectivly, how do you do it for the linker?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I sourced the ifortvars.sh, iccvars.shto change to the 32 bit compiler for ifort and C respectivly, how do you do it for the linker?
You are using out of date versions of the compilers; an upgrade might be indicated, if only so that the advice seen on this forum may be more relevant.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page