- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello!
I installed VS2019 Community and ifort 2021.1.2.
If I create a new project inside VS2019 with default "Hello World" code, it perfectly runs using F5 command (Start Debugging). But if I try to compile and run the same code using command line with ifort helloworld.f90, I get LINK : fatal error LNK1104: cannot open file 'ifconsol.lib'.
I have tried to manually include path to fortran libs like
ifort helloworld.f90 /link /LIBPATH:"C:\Program Files (x86)\Intel\oneAPI\compiler\2021.1.2\windows\compiler\lib\intel64_win"
and in this case I get large list of errors. Here are start and end of this list:
LINK : error LNK2001: unresolved external symbol mainCRTStartup
libifcoremt.lib(for_reentrancy.obj) : error LNK2019: unresolved external symbol __imp_Sleep referenced in function for__reentrancy_cleanup
libifcoremt.lib(for_aio.obj) : error LNK2001: unresolved external symbol __imp_Sleep
OLDNAMES.lib(access.obj) : error LNK2001: unresolved external symbol __access
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\lib\x86\LIBCMT.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64'
C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\um\x86\kernel32.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64'
C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\um\x86\uuid.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64'
C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\um\x86\ImageHlp.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64'
helloworld.exe : fatal error LNK1120: 133 unresolved externals
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You're using the 32-bit target compiler with 64-bit target libraries. The two don't mix.
When you start the command prompt, if you are using the Intel-installed shortcuts make sure you use the correct one. If you are doing it from a standard command prompt and invoking setvars.bat to establish the environment, make sure you select ia32 or intel64 as desired.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You're using the 32-bit target compiler with 64-bit target libraries. The two don't mix.
When you start the command prompt, if you are using the Intel-installed shortcuts make sure you use the correct one. If you are doing it from a standard command prompt and invoking setvars.bat to establish the environment, make sure you select ia32 or intel64 as desired.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you! Fixed by using setvars.bat (located in C:\Program Files (x86)\Intel\oneAPI). After executing "setvars.bat --force x64 vs2019", Visual Studio environment started to be initialized for x64 and now there is no problem with linking in console.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Steve,
Thanks for a swift answer!
Yes, I had used the 32-bit command line.
Maybe these lines should start with 32 or 64, in order to reduce risks for error!
Best regards
Anders S

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