什么是未定义的引用/未解决的外部符号错误,如何在 Fortran 中修复它? [英] What is an undefined reference/unresolved external symbol error and how do I fix it in Fortran?

查看:22
本文介绍了什么是未定义的引用/未解决的外部符号错误,如何在 Fortran 中修复它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建一个 Fortran 程序,但我收到有关未定义引用或未解析外部符号的错误.我已经看到关于这些错误的another question,但那里的答案大多特定于 C++.

I am trying to build a Fortran program, but I get errors about an undefined reference or an unresolved external symbol. I've seen another question about these errors, but the answers there are mostly specific to C++.

在 Fortran 中编写时这些错误的常见原因是什么,我该如何修复/防止它们?

What are common causes of these errors when writing in Fortran, and how do I fix/prevent them?

推荐答案

有很多可能的方式可以看到这样的错误.在尝试构建程序(链接错误)或运行程序(加载错误)时,您可能会看到它.不幸的是,很少有简单的方法可以查看您的错误原因.

There are many possible ways you can see an error like this. You may see it when trying to build your program (link error) or when running it (load error). Unfortunately, there's rarely a simple way to see which cause of your error you have.

此答案提供了其他答案的摘要和链接,以帮助您浏览.您可能需要阅读所有答案才能解决您的问题.

This answer provides a summary of and links to the other answers to help you navigate. You may need to read all answers to solve your problem.

出现此类链接错误的最常见原因是您没有正确指定外部依赖项正确地将代码的所有部分放在一起.

The most common cause of getting a link error like this is that you haven't correctly specified external dependencies or do not put all parts of your code together correctly.

在尝试运行您的程序时,您可能有一个缺少或不兼容的运行时库.

When trying to run your program you may have a missing or incompatible runtime library.

如果构建失败并且您指定了外部依赖项,您可能会遇到编程错误,这意味着编译器正在寻找错了.

If building fails and you have specified external dependencies, you may have a programming error which means that the compiler is looking for the wrong thing.

这篇关于什么是未定义的引用/未解决的外部符号错误,如何在 Fortran 中修复它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆