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

Mixing programming - C/Fortran

maciej
Beginner
1,078 Views
Hello,

I have commercial CAD software that accepts compiling codes written in C in its environment. It also accepts mixing that C with Fortran. For compilation it uses Microsoft Visual Studio 2008 to compile the C routines. I managed to compile the C code and at the phase of linking with fortran generated obj file I get a message:

LINK : fatal error LNK1181: cannot open input file 'Files.obj'

I know what that error means but I cannot find that mentioned file anywhere. I dont know if that problem can ever be solved but maybe someone has any hint of what or where that file is. Or maybe its some kind of misconfiguration in that software compilation environment?

Of course I could do my tasks in C but Fortran is so superior over C at mathematical tasks...
0 Kudos
6 Replies
Steven_L_Intel1
Employee
1,078 Views
This is a problem parsing a file path that contains "Program Files". You may need to enclose a file path in "" to get it to parse correctly, though usually this is not necessary when using Visual Studio. Can you attach the build log and the .vfproj file for the project that does the linking?
0 Kudos
maciej
Beginner
1,078 Views
The linking is not done in Visual Studio but in the CAD environment. Its log output is quite short:

[bash]Microsoft  C/C++ Optimizing Compiler Version 15.00.21022.08 for x64
Copyright (C) Microsoft Corporation. All rights reserved.

NMAKE : U1077: '"c:Program Files (x86)Microsoft Visual Studio 9.0VCBINamd64link.EXE"' : return code '0x49d'
Stop.[/bash]
The screen output says:
[bash]Microsoft  Incremental Linker Version 9.00.21022.08
Copyright (C) Microsoft Corporation.  All rights reserved.

LINK : fatal error LNK1181: cannot open input file 'Files.obj'[/bash]

The fortran part of compilation is done this way (excerpt from log):

Compiling with Intel Visual Fortran 11.1.051 [Intel 64]... ifort /nologo /debug:full /Od /gen-interfaces /warn:interfaces /module:"x64\Debug\" /object:"x64\Debug\" /traceback /check:bounds /libs:static /threads /dbglibs /c /Qvc9 /Qlocation,link,"c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64" "E:\Moje dokumenty\Visual Studio 2008\Projects\flnttest\flnttest\flnttest.f90"

It produces the obj file that I wish to link to the C code compiled in CAD environment. Of course here I did not use the switch to prevent it from trying to link (in fact I didn't found it) so the link phase here is not succesful (but I don't want to produce .exe file, I need obj only).

The fortran program is simple testing function:

[fortran]real*8 function test(a, b)
real*8 a, b
test = a + b
end function test[/fortran]

The C counterpart:

[cpp]#if defined(_WIN32)
# define test_ TEST
#endif

/* FORTRAN FUNCTION */
extern double test_(double *a, double *b);

and in the executable part of the code I make call:
c = test_(&a, &b);
[/cpp]

I made many routines (in C) that are hooked that way into the CAD engine but this is first time I tried also to link it with fortran obj file. I realize that this is not typical use, especially that the compilation is performed by the CAD software itself by the call to the Visual Studio tools (it must be installed for that to work but the IDE need not be run at all) - so I'd be happy for any hint.



0 Kudos
Steven_L_Intel1
Employee
1,078 Views
The key part is what you didn't show - the makefile.
0 Kudos
maciej
Beginner
1,078 Views
I'd be happy to attach the makefile here but as it is a part of a commercial product it is surely copyrighted.
Besides I think that academic discourse is allowed even using this file so maybe I could send it by other means instead of presenting it in public?

0 Kudos
Steven_L_Intel1
Employee
1,078 Views
I'm primarily interested in the line that links the application. If you want, you can reply and check the box to mark the reply Private - then only you and Intel support can see the rest of the discussion.
0 Kudos
maciej
Beginner
1,078 Views
Now I have permission from software developer so I will prepare that file and attach it here.

Thanks in advance.
0 Kudos
Reply