Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28996 Discussions

unresolved external: C calling Fortran

barakobama
Beginner
375 Views

I got unresolved external symbol _MAIMPROG referenced in function _main.


I am using Intel Fortran v9 and Studio 2005.

I ran a very simple program C calling Fortran
and made the fort_lib depends on C project
so that the library is built first and then is linked into the C code.


C:

extern void MAINPROG();

int main()
{
MAINPROG();
return 0;
}


Fortran:

SUBROUTINE MAINPROG()
return
end


Actually, I convert it to a new solution from CVF VC++6.
I made the libraryusing "Extract CVF Project Items".

Thanks.

K Hong

0 Kudos
1 Reply
Steven_L_Intel1
Employee
375 Views
Converting a CVF project applies various options for CVF compatibility - two of these relate to calling conventions. Your code would not have worked with CVF without other options.

Right click on the project, select Properties, Fortran, External Procedures. Change the calling convention to "Default" (or "inherit from project defaults") and do the same for string length argument passing. Then rebuild.
0 Kudos
Reply