Calling C from Fortran

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am using an iMac running 10.6.7.

I have a simple Fortran program that uses a simple C function and am working at the command line in Terminal.

I compile the C function with:

gcc -c createfile_.c

I then compile and link with:

gfortran test_file_handling.f90 createfile_.o

And get the error message:

ld: warning: in createfile_.o, file was built for unsupported file format which is not the architecture being linked (i386)
Undefined symbols:
  "_createfile_", referenced from:
      _MAIN__ in cc1JcwIf.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

I then tried to define the architecture with:

gcc -c -mtune=i386 createfile_.c

and got the error message:

createfile_.c:1: error: CPU you selected does not support x86-64 instruction set

I tried other values of -mtune but have been unsuccessful.  I have searched help forums and Googled but have not found answers that seem applicable.

Please advise me regarding how to compile and link for using C functions in gfortran.
 
Hugh McCutchen
coml2@xxxxxxxxxx


Note:  gcc is a link that points to gcc-4.2 dated October 23, 2010.
Note:  I have appended an underscore to the C function name.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux