将MS C++与“英特尔Fortran”链接时出现致命错误LNK1104(找不到.lib文件)
fatal error LNK1104 (.lib file not found) when linking MS C++ with Intel Fortran
我有两个文件source1.f90
和main.cpp
。Fortran文件有一个子例程,cpp文件有一个调用Fortran子例程的程序
我编译了Fortran文件,并使用以下命令行选项构建了一个静态库文件
ifort source1.f90 /nologo /debug:full /Od /gen-interfaces /warn:interfaces /traceback /check:bounds /libs:static /threads /dbglibs /c
lib /out:lib1.lib source1.obj
但是当我使用编译cpp文件时
CL main.cpp /link LIB1.LIB
我得到以下错误
D:temp>CL main.cpp /EHsc /link LIB1.LIB
Microsoft (R) C/C++ Optimizing Compiler Version 17.00.60610.1 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
main.cpp
Microsoft (R) Incremental Linker Version 11.00.60610.1
Copyright (C) Microsoft Corporation. All rights reserved.
/out:main.exe
LIB1.LIB
main.obj
LINK : fatal error LNK1104: cannot open file 'ifmodintr.lib'
如何解决此问题以便编译程序?
一般来说,您会错过Visual Studio中混合编程环境的设置。只需点击英特尔提供的链接:https://software.intel.com/en-us/articles/configuring-visual-studio-for-mixed-language-applications.
或者简单地说,在项目配置选项卡中添加fortran编译器包含目录和库目录。在我的情况下,fortran编译器目录是"g:\Program Files(x86(\IntelSWTools\compilers_and_libraries\windows\compiler\include\intel64",而库目录是"g:\Program Files。
相关文章:
- 编译要在英特尔Hyperscan中使用的.cc文件时出现问题
- 将gsl c++程序与"英特尔MKL"链接
- 使用英特尔 PIN 修改寄存器
- 使用英特尔内联函数将打包的 8 位整数乘以浮点数向量
- 如何使用英特尔 PIN 捕获阵列的所有负载?
- 英特尔 TBB 程序不会终止,可能会误用参考计数器
- 将"-01"替换为"-02" 英特尔编译器选项会导致 FPE 在较小的 for 循环行程计数中抛出
- 在 Azure DevOps 构建管道中使用英特尔C++编译器为 Linux 环境构建C++代码
- 编译器错误(英特尔并行工作室 2019 与 Visual Studio 社区 2019)
- 如何要求 macports 用英特尔编译器包装 openmpi?
- 实施英特尔实感和 SDL2 时出现问题
- OpenGL 片段着色器未在英特尔 HD 4000 显卡上编译
- 英特尔将指令存储在重叠的内存区域
- 如何指示 CMAKE 在 Visual Studio 中使用英特尔 MKL
- 使用英特尔内部函数 (AVX) 中的混合说明
- 英特尔 PIN:如何查看推测性指令?
- 我正在尝试解决英特尔架构并行基础课程中关于 Coursera 的一项作业
- 使用 task_group 的英特尔线程构建模块性能不佳(新用户)
- 如果由不同的线程写入 8 字节,那么现代英特尔 x86 上的 8 字节读取是否保证理智?
- 将MS C++与“英特尔Fortran”链接时出现致命错误LNK1104(找不到.lib文件)