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

Mixing C/FORTRAN and calling Quickwin from FORTRAN problem

Yong_Tang1
Beginner
698 Views
Hi,

I am using Visual Studio 2005 to build a solution in which I am mixing a c project (main program) and a FORTRAN project (static library). I made c calling fortran subroutine compiled successfully by reading some of the threads in this forum. However, the linker still gave me problems because I am calling some quickwin functions within the FORTRAN subroutine. If I compile the fortran codes as a stand-alone project, it works. Here is a simplified version of my projects:

in C

#include

#include

extern void CE();

int main (int argc, char **argv)

{

CE();

}


In FORTRAN

subroutine CE() BIND(C, NAME="CE")

xxxxxxxxxxxxxxxx ! declarations

res = SETWINDOWCONFIG(wcMain)


end subroutine

When I build the solution, it gave me an error like

Error 1 error LNK2019: unresolved external symbol __f_setwindowconfig referenced in function _CE ce.lib

I am using IVF 12.X. I added the fortran library path in VS2005. I alsoMade my C program depending on FORTRAN. I don't know how to fix this error. Can anybody help? Thanks in advance!

Yong

0 Kudos
4 Replies
mecej4
Honored Contributor III
698 Views
Did you specify that ifqwin.lib should be included in the link step, either directly or through compiler options/directives?
0 Kudos
Yong_Tang1
Beginner
698 Views
I actually used

use msfwin

in my FORTRAN code


How do I specify that this libraray should be included in the link step?
0 Kudos
Steven_L_Intel1
Employee
698 Views
MSFWIN is for Win32 API routines, not QuickWin, and it would be better to use IFWIN or perhaps the individual modules for the Win32 libraries.

First, you need to follow the steps here to configure Visual C++ for mixed-language applications. Then you need to change the Fortran project property Libraries > Use Runtime Library to "QuickWin" and Disable Default Library Search Rules to "No". Then rebuild both projecs.
0 Kudos
Yong_Tang1
Beginner
698 Views

Sorry, steve. I actually used both Win32 API and QuickWin functions. Since the original stand-alone FORTRAN project used quickwin project type to begin with, we did not have to "use" it in the code. I did what you told me to do and it worked like a charm! Thanks a billion! I will have to test my application to make sure it is working as it supposed to be now.

Thanks again!

0 Kudos
Reply