- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I successfully build the solution with the Intel supplied sample few days ago. I played around with Visual Studio 207 for few days attempting create the same project/solution from scratch. In the process I seemed to mess up the projects settings. Even when I start from a fresh copy of the sample folder, I am getting Linker errors.
The attached file includes the output from the Visual Studio and also screen captures from VS 2017 property sheets for the VC++ directories and Linker. I would appreciate it if anyone can point out the reason for the error messages.
Thanks in advance.
I. Konuk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The configuration described is in effect for all C++ projects in that version of Visual Studio. You don't need to repeat it.
What you WILL have to do is explicitly add your Fortran library to the C++ project's list of libraries to search (or add the .lib as if it were a source file). Microsoft made a change a couple of versions ago where C++ projects no longer automatically link in libraries of non-C++ dependent projects.
You'll also want to add the Fortran library project as a "dependent project" of the C++ main project.
Fortran calling C++ is a bit easier. You don't need to configure anything special in general. If the C++ project is a static library, it is sufficient to make it a dependent of the Fortran project, but if it is a DLL you'll have to add the DLL's export library explicitly.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
See https://software.intel.com/en-us/articles/configuring-visual-studio-for-mixed-language-applications , as explained in the README FIRST that accompanies this sample.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve:
Thank you very much again. I thought I did all that. It looks like I am getting old and tired. I mispelled the entry (missing closing paranthesis in the library macro).
Since I got your attention, may ask if I can export from Visual Studio (Tools > Import & Export) this project (C_calls_Fortran) properties and start a new solution and import it? Or would I manually have to do what you describe in the referenced Web documentation whenever I start a new solution/project with C++ (VC++) calling Fortran?
Second silly question, the web documentation applies to Fortran calling C++, right?
Thank you again for your generous help.
I. Konuk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The configuration described is in effect for all C++ projects in that version of Visual Studio. You don't need to repeat it.
What you WILL have to do is explicitly add your Fortran library to the C++ project's list of libraries to search (or add the .lib as if it were a source file). Microsoft made a change a couple of versions ago where C++ projects no longer automatically link in libraries of non-C++ dependent projects.
You'll also want to add the Fortran library project as a "dependent project" of the C++ main project.
Fortran calling C++ is a bit easier. You don't need to configure anything special in general. If the C++ project is a static library, it is sufficient to make it a dependent of the Fortran project, but if it is a DLL you'll have to add the DLL's export library explicitly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve:
Thank you indeed very much.
I have prepared a fairly thorough step by step analysis or instructions for building a mixed language (C++ calling Fortran) based on the sample supplied with the compiler (for my own benefit). I would like to share it with you or any other beginners of course without any warranties. Please let me know if I have made any errors or missed an important step or element.
Bests regards;
I. Konuk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The first part, 1a, describes a one-time configuration that is unrelated to project settings.
It might be helpful to the reader to note that this particular example uses "advanced" C interoperability features from Fortran 2018 and that a lot of mixed Fortran-C programs might just need the basic interoperability features from Fortran 2003.
If I were reading such a document, I'd appreciate an explanation of why each step was needed and what it accomplished. Project Dependencies probably warrants explanation on its own. You might also want to explain why there is a USELIB and USEDLL part of the example.
My concern is that the novice jumping into this may get the impression that mixed-language programs are more complicated than they are in reality.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve:
Thank you very much for your comments. I will work on it. In the meantime, (if there is one around) could you point me to a sample project/solution using interoperability features from FORTRAN 2003?
Regards;
I. Konuk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried to build Release version of the programs (C_calls_Fortran) . I am getting a CL error (D8021). The follwing is the output:
1>------ Skipped Rebuild All: Project: README_FIRST, Configuration: Release Win32 ------ 1>Project not selected to build for this solution configuration 2>------ Rebuild All started: Project: FDLL, Configuration: Release Win32 ------ 3>------ Rebuild All started: Project: FLIB, Configuration: Release Win32 ------ 2>Deleting intermediate files and output files for project 'FDLL', configuration 'Release|Win32'. 3>Deleting intermediate files and output files for project 'FLIB', configuration 'Release|Win32'. 3>Compiling with Intel(R) Visual Fortran Compiler 18.0.3.210 [IA-32]... 3>FSUB.F90 2>Compiling with Intel(R) Visual Fortran Compiler 18.0.3.210 [IA-32]... 2>FSUB.F90 3>Creating library... 2>Linking... 3> 3>Build log written to "file://C:\AArea\ik18a\MixedPrgmTest2\C_calls_Fortran\FLIB\msvs\Release\BuildLog.htm" 3>FLIB - 0 error(s), 0 warning(s) 4>------ Rebuild All started: Project: C_USELIB, Configuration: Release Win32 ------ 4>cl : Command line error D8021: invalid numeric argument '/wdC4200' 4>Done building project "USELIB.vcxproj" -- FAILED. 2>Creating library Release/FDLL.lib and object Release/FDLL.exp 2>Embedding manifest... 2> 2>Build log written to "file://C:\AArea\ik18a\MixedPrgmTest2\C_calls_Fortran\FDLL\msvs\Release\BuildLog.htm" 2>FDLL - 0 error(s), 0 warning(s) 5>------ Rebuild All started: Project: C_USEDLL, Configuration: Release Win32 ------ 5>cl : Command line error D8021: invalid numeric argument '/wdC4200' 5>Done building project "USEDLL.vcxproj" -- FAILED. ========== Rebuild All: 2 succeeded, 2 failed, 1 skipped ==========
I am not sure what /wdC4200 mean or originate from? Any help would be appreciated.
I. Konuk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I found the source of the problem. I do not know why, but in the project release configuration, there was the entry "C4200" under the "C/C++" configuration on "Advanced" page, "Disable Specific Warnings". I deleted those entries and it all worked. I would appreciate knowing if anybody has a guess where it came from.
Steve: One more item to include on the check list.
I. Konuk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Further experimentation indicates that VS 2017 will accept 4200 rather than C4200 in the "Disable Specific Warnings" field. However, it does not stop the warning messages.I think I have seen a message somewhere from Steve stating the same.
I. Konuk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Interesting - I can see that is there. Maybe it's left over from my attempt to disable that warning (I created this sample) and I missed a configuration. Good detective skills!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That looks pretty good.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page