none
error LNK2019: unresolved external symbol _MAIN__ referenced in function _main libifcoremt.lib

    Question

  • Hi,

     

    I am  very new to using Visual Studio.  I'm developing a project for my internship that uses a VC++ GUI to call a FORTRAN program.  I'm right now using just a simple FORTRAN program and trying to connect to it to the C++ code developed with my GUI.  I've been learning bits and pieces of VC++ all summer, but cannot get over this errors:

     

    error LNK2019: unresolved external symbol _MAIN__ referenced in function _main libifcoremt.lib

    fatal error LNK1120: 1 unresolved externals ..\Project100\Console4.exe
      fatal error LNK1104: cannot open file 'Console4.lib' Project100

    I think the second and third errors are related to the first error, and solving that will solve the rest.

    I'm using Visual Studio 2005, and Intel FORTRAN compiler.  Any help would be greatly appreciated!!

     

    In my C++ code, I define the FORTRAN by:

     

    #ifdef __cplusplus

    extern "C"

    {

    void CONSOLE1(int *TSTART, int *answer);

    }

    #endif

     

    and call it as:

     

    CONSOLE1(&TSTART, &answer);

     

    My FORTRAN is a simple file that looks like this:

     

    SUBROUTINE CONSOLE1(N, M)

    IMPLICIT NONE

     

    INTEGER N

    INTEGER M

     

    M = N*N

    RETURN

    END

     

    MAIN and main do not exist anywhere in my work, which is why the error confuses me.  And I've added to my additional directories Console4.lib, the library file to the FORTRAN program (I think).  Thanks in advance for any help!!

    Friday, July 20, 2007 4:48 PM

All replies