gpt4 book ai didi

c - __iob_func 在使用 GSL 库时在函数 _gsl_error 中引用

转载 作者:太空宇宙 更新时间:2023-11-04 04:18:29 29 4
gpt4 key购买 nike

在 Visual Studio 2017 上使用 GSL 库 2.4 并在编译和运行时出现这些错误,

Severity    Code    Description Project File    Line    Suppression State
Error LNK2019 unresolved external symbol ___iob_func referenced in function _gsl_error
ImplementerGSL C:\Users\MyUserName\source\repos\ImplementerGSL\ImplementerGSL\gsl.lib(error.obj) 1

Severity Code Description Project File Line Suppression State
Error LNK2001 unresolved external symbol ___iob_func ImplementerGSL
C:\Users\MyUserName\source\repos\ImplementerGSL\ImplementerGSL\gsl.lib(stream.obj) 1
Severity Code Description Project File Line Suppression State

Error LNK2019 unresolved external symbol _fprintf referenced in function _gsl_error ImplementerGSL
C:\Users\MyUserName\source\repos\ImplementerGSL\ImplementerGSL\gsl.lib(error.obj) 1

Severity Code Description Project File Line Suppression State
Error LNK2001 unresolved external symbol _fprintf ImplementerGSL
C:\Users\iTzEinstein118Xx\source\repos\ImplementerGSL\ImplementerGSL\gsl.lib(stream.obj) 1

有关机器和项目的更多详细信息;

  • Visual Studios 2017 Fall Creators Update 的最新更新
  • 用 C(不是 C++)编码
  • GSL 是 GNU 科学图书馆,不要与 GSL.Microsoft 混淆
  • 最新版本的 GSL 库安装在 C:/gsl。已知与 VS2017 兼容
  • 解决方案属性已被编辑为指向 GSL 库,附加*包含目录:C:\gsl\include 附加库目录:C:\gsl\lib 附加依赖项:gsl.lib;cblas.lib预处理器定义:_GSL_DLL

我的最终目标是将该库用于另一个项目。但是,我无法让这个简单的测试代码工作。代码是用C写的,VS2017安装了C++库等等。源文件已重命名为 .c 而不是 .cpp。

我的代码:

#include "stdafx.h"
#include <stdlib.h>
#include <gsl/gsl_sf_bessel.h>


int main()
{
double x, y;
x = 5.0;
y = gsl_sf_bessel_zero_J0(x);
printf("J0(%g) = %.18e\n", x, y);
return 0;
}

然后是我的 stdafx 头文件,

#pragma once

#include "targetver.h"

#include <stdio.h>
#include <tchar.h>

我现在已经做了相当多的研究,但似乎无法找到任何具体解决此问题的方法。对不起,如果这是一个重复的答案,但如果有另一个问题确实解决了这个问题,我很想知道它!感谢您提前提供帮助。附言。 C 新手,但熟悉 C#。

编辑更新*:添加了遗留库,但这仍然留下未解析的外部符号 __iob_func(前两个错误)。

最佳答案

经过大量的挖掘和摆弄,我找到了一个解决方法。

通过在本地安装 Nuget 包,而不是在 C 驱动器顶层。这意味着只需调整所有链接器输入等。我非常确定这样做的原因是因为 NuGet 包是直接为 VS2017 编译的,从而完全避免了 VS2017 和 VS2015 之间的任何构建/编译问题。

感谢指点和意见!实际上让我更深入地研究其他一些想法并找到解决方案!!

关于c - __iob_func 在使用 GSL 库时在函数 _gsl_error 中引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49331499/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com