'Compiling C and Fortran using iFort

I am trying to call a simple "Hello World" code from C using Fortran. When I compile using iFort, it is giving me "error LNK2019: unresolved external symbol HELLO referenced in function MAIN__"

C Code:

#include <stdio.h>

void hello_(){

    printf("Hello World :) \n");
}

Fortran Code:

       program Fortran_C_Link_Test
C
      implicit None
C
      call hello()
C
      stop
      end

How I Compiled:

cl -c c_src.c 

to generate the c_src.obj object file

ifort -c fortran_src.f 

to generate the fortran_src.obj object file

ifort -o program c_src.obj fortran_src.obj

to generate the executable



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source