I'm having problem with these errors for weeks. I read every topic based on this problem but no advice worked for me.
Visual Studio 2010 Professional and Intel(R) Visual Fortran Composer XE 2011.
This is the output:
1>------ Rebuild All started: Project: Projekat, Configuration: Debug Win32 ------
1>Build started 15-Apr-14 4:00:28 PM.
1>_PrepareForClean:
1> Deleting file "Debug\Projekat.lastbuildstate".
1>InitializeBuildStatus:
1> Touching "Debug\Projekat.unsuccessfulbuild".
1>ClCompile:
1> Glavni.cpp
1>Glavni.obj : error LNK2019: unresolved external symbol _K1 referenced in function _main
1>C:\Users\Stevic\Documents\Visual Studio 2010\Projects\Projekat\Debug\Projekat.exe : fatal error LNK1120: 1 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:01.09
2>------ Rebuild All started: Project: OtpRasp, Configuration: Debug Win32 ------
2>Deleting intermediate files and output files for project 'OtpRasp', configuration 'Debug|Win32'.
2>Compiling with Intel(R) Visual Fortran Compiler XE 12.0.5.221 [IA-32]...
2>Otpor.f90
2>Creating library...
2>
2>Build log written to "file://C:\Users\Stevic\Documents\Visual Studio 2010\Projects\Projekat\OtpRasp\Debug\BuildLog.htm"
2>OtpRasp - 0 error(s), 0 warning(s)
========== Rebuild All: 1 succeeded, 1 failed, 0 skipped ==========
This is the Fortran code :
MODULE OTPOR_RASP
REAL FUNCTION k1 (x) BIND (C, NAME = "k1")
USE, INTRINSIC :: ISO_C_BINDING, ONLY: C_INT, C_FLOAT
IMPLICIT NONE
!DEC$ ATTRIBUTES DLLEXPORT :: k1
REAL(C_FLOAT):: x
INTEGER(C_INT) :: x1, x2
!REAL(C_FLOAT) :: y(8) = (/1.37, 1.33, 1.28, 1.24, 1.2, 1.16, 1.13, 1.11/)
x1 = CEILING (x)
x2 = FLOOR (x)
!k1 = y(x1) + ((x - x1) * (y(x2) - y(x1))) / (x2 - x1)
k1=x1 + x2
RETURN
END FUNCTION k1
END MODULE OTPOR_RASP
This is a C++ code:
#include <iostream>
#include <math.h>
#include <fstream>
#include "Funkcije.h"
#include <string>
using namespace std;
extern "C"
{
double K1 (double);
}
int main()
{
...
...
double v = 4;
double k = K1 (v);
system("pause");
return 0;
}
Please help me.
Thank you in advance!