- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear community,
We struggled to migrate a Win32 C++/Fortran mixed language application to VS 2022 MSVC / oneAPI classic ifort using a cmake build system.
To be more precise, we used
Intel® oneAPI standalone component installation files
Intel Fortran Compiler Classic and Intel Fortran Compiler for Windows*
It was difficult to figure out how to make cmake use this compiler in the first place. The solution we found after some hours of research was to initialize the environment variables as follows:
"C:\Program Files (x86)\Intel\oneAPI\setvars-vcvarsall.bat" ia32
"C:\Program Files (x86)\Intel\oneAPI\setvars.bat" ia32
set FC=ifort
However, when doing that, we encountered link errors when trying to link the basic runtime library
target_link_libraries(SMILE PUBLIC libifcore.lib)
C:\Program Files (x86)\Intel\oneAPI\compiler\latest\windows\compiler\lib\intel64_win\libifcore.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86'
C:\Program Files (x86)\Intel\oneAPI\compiler\latest\windows\compiler\lib\intel64_win\ifmodintr.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86'
This error can be avoided by explicitly specifying the library search path for the x86 version:
target_link_directories(SMILE_Solver_static PUBLIC
"C:/Program Files (x86)/Intel/oneAPI/compiler/2023.1.0/windows/compiler/lib/ia32"
)
However, this does not feel right – why does this have to be specified explicitly after the environment variables have been set explicitly for the x86 architecture?
Furthermore, the only cmake generator that seems to be able to build mixed C++ / FORTRAN mixed language projects seems to be “NMake Generator” – is that right? This generator does not allow for multi-config builds, right?
It would be great if VS2022’s cmake integration could be used for mixed language projects (which is possible with mingw-gcc), but we did not manage to use it. That makes debugging somewhat difficult.
Regards
Ingo and Bernd
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Seems like your environment is not setup correctly.
Try setting up your environment in a command prompt window using only:
"C:\Program Files (x86)\Intel\oneAPI\setvars.bat" ia32
That link error is showing that you are trying to link a 64-bit library (x64) with your 32-bit application.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page