将Fortran库链接到VC8中的c ++代码时出错 [英] error when linking a Fortran library to c++ code in VC8

查看:59
本文介绍了将Fortran库链接到VC8中的c ++代码时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在Fort 2005中将fortran库链接到c ++代码

时出现以下错误。


链接:致命错误LNK1104 :无法打开文件''libc.lib''


使用.NET2003构建代码时工作正常。

当我不尝试时链接fortran库(只是为了看看原因是否是
),它构建了exe而没有任何问题。


i甚至不知道如何开始解决这个问题...任何帮助将是

赞赏。


谢谢,

朱利安。

解决方案

" Julian" <菊**** @ nospamtamu.edu>在留言中写道

新闻:%2 **************** @ TK2MSFTNGP09.phx.gbl ...

我得到了当我尝试将Fortran库链接到.NET 2005中的c ++
代码时出现以下错误。

LINK:致命错误LNK1104:无法打开文件''libc.lib''当我不尝试链接fortran库时(只是为了看看是否是原因),它构建了exe没有任何问题。

我甚至不知道如何开始解决这个问题......任何帮助都会受到赞赏。




您提到的单线程库已从VS2005中删除。在这里看到



http://msdn2.microsoft.com/en-us/library/abx4dbyh.aspx


这应该是一个简单的问题,切换到多线程库来获得你建立项目的
。这个盒子没有安装2005,但如果你在
找不到项目属性对话框中的设置,请再次发布

,我会回复稍后关于机会的说明没有其他人

先让你直接。


问候,





" William DePalo [MVP VC ++]" < WI *********** @ mvps.org>在消息中写道

news:ef ************** @ TK2MSFTNGP09.phx.gbl ...


您提到的单线程库已从VS2005中删除。请参阅


http://msdn2.microsoft.com/en-us/library/abx4dbyh.aspx

这应该是一个简单的问题,切换到多线程库来获取你的项目要建立。这个盒子没有安装2005,但是如果你在项目的属性对话框中找不到设置,那么
会再次发布,我会稍后回复说明关闭机会没有人
首先让你直截了当。

问候,




感谢您的回复。

我看到当我将c ++项目从2003升级到2005时,它会自动使它成为多线程的。

但它是FORTRAN库。单线程的。所以,我想我需要

使用多线程选项重建FORTRAN库?在这个特殊的

的情况下,这是可能的,因为我有库的源代码。但是,如果我使用的是第三方库,我没有源代码,那么是什么?


我会被卡住吗?

,为了编译FORTRAN库并使用我的vc8

代码运行它,我是否必须使用最新的多线程CRT?或者任何版本

(这是仅用于重建FORTRAN库)?


Julian。


"儒略" <菊**** @ nospamtamu.edu>在消息中写道

新闻:OO ************* @ TK2MSFTNGP14.phx.gbl ...

感谢您的回复。


欢迎您。

我看到当我将c ++项目从2003升级到2005年时,它自动使其成为多线程的。


好​​的。

但它是FORTRAN库是单线程的。所以,我想我需要
用多线程选项重建FORTRAN库?


首先是免责声明:我最后一次以
定期进行任何Fortran开发时,我坐在IBM 029 keypunch nachine上。我怀疑,自黑暗时代以来,事情发生了很大的变化。 :-)


这就是说,我不认为你应该重建你的Fortran

库,虽然我可能错了。

但是,如果我使用的是第三方库,我没有
来源怎么办?我会被卡住吗?


当您尝试将使用一个库构建的组件中创建的对象的
引用传递给
$时,通常会出现库不匹配的问题。 b $ b组件构建在另一个组件中。例如,将C文件句柄或指针传递给使用malloc()或new运算符分配的块,可能会咬你,

,具体取决于被调用者如何使用它们。


我怀疑C或C ++运行时是否足够类似于

Fortran允许这种有问题的共享。当然,我可能是错误的b $ b。


相反,我认为通过使用多线程运行时你会得到你的

应用程序可安全用于多线程。使用单线程我希望你有b $ b,这应该是一个单元。

,为了编译FORTRAN库并使用我的
vc8代码,我是否必须使用最新的多线程CRT?或者是否会有任何
版本(这仅用于重建FORTRAN库)?




正如我所说的,我必须因为我的问题而避开Fortran问题缺乏

的经验。你使用谁的编译器?你的图书馆

怎么办?如果你再次发帖,有Fortran知识的人可能会出现。如果没有人

,你可能会再次发布


microsoft.public.vc.language


我觉得这个流量比这个群体多一点。


问候,



I get the following error when i try to link a fortran library to a c++ code
in .NET 2005.

LINK : fatal error LNK1104: cannot open file ''libc.lib''

the code was working fine when built using .NET2003.
also, when I do not try to link the fortran library (just to see if that was
the cause), it builds the exe without any problems.

i don''t even know how to begin addressing this problem...any help would be
appreciated.

thanks,
Julian.

解决方案

"Julian" <ju****@nospamtamu.edu> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...

I get the following error when i try to link a fortran library to a c++
code in .NET 2005.

LINK : fatal error LNK1104: cannot open file ''libc.lib''

the code was working fine when built using .NET2003.
also, when I do not try to link the fortran library (just to see if that
was the cause), it builds the exe without any problems.

i don''t even know how to begin addressing this problem...any help would be
appreciated.



The singly threaded library you mention has been removed from VS2005. See
here:

http://msdn2.microsoft.com/en-us/library/abx4dbyh.aspx

It should be a simple matter of switching to a multithreaded library to get
your project to build. This box does not have 2005 installed, but if you
have trouble finding the setting in the project''s properties dialog, post
again and I''ll reply with instructions later on the off chance no one else
sets you straight first.

Regards,
Will



"William DePalo [MVP VC++]" <wi***********@mvps.org> wrote in message
news:ef**************@TK2MSFTNGP09.phx.gbl...


The singly threaded library you mention has been removed from VS2005. See
here:

http://msdn2.microsoft.com/en-us/library/abx4dbyh.aspx

It should be a simple matter of switching to a multithreaded library to
get your project to build. This box does not have 2005 installed, but if
you have trouble finding the setting in the project''s properties dialog,
post again and I''ll reply with instructions later on the off chance no one
else sets you straight first.

Regards,
Will



thanks for the reply.
I see that when I upgraded my c++ project from 2003 to 2005, it
automatically made it multi-threaded.
but it is the FORTRAN library that is single-threaded. so, I guess I need to
rebuild the FORTRAN library with the multi-thread option? in this particular
case, that is possible since I have the source code to the library. but what
if I was using a third-party library to which I didn''t have the source?
would I be stuck then ?
also, in order to compile the FORTRAN library and get it running with my vc8
code, do I have to use the latest multi-threaded CRTs? or will any version
do (this is for rebuilding the FORTRAN library alone)?

Julian.


"Julian" <ju****@nospamtamu.edu> wrote in message
news:OO*************@TK2MSFTNGP14.phx.gbl...

thanks for the reply.
You are welcome.
I see that when I upgraded my c++ project from 2003 to 2005, it
automatically made it multi-threaded.
OK.
but it is the FORTRAN library that is single-threaded. so, I guess I need
to rebuild the FORTRAN library with the multi-thread option?
First the disclaimer: the last time I did any Fortran development on a
regular basis I was sitting at an IBM 029 keypunch nachine. I suspect that
things have changed a lot since the dark ages. :-)

That said, I don''t think that you should have to rebuild your Fortran
library though I may be wrong.
but what if I was using a third-party library to which I didn''t have the
source? would I be stuck then ?
The problem of mismatched libraries usually occurs when you try to pass
references to objects created in a component built with one library to a
component built in another. Passing, for example, C file handles or pointers
to blocks allocated with malloc() or the new operator, may bite you,
depending on how the callee uses them.

I doubt that either the C or C++ runtime is similar enough to that of
Fortran to allow this kind of problematic sharing. Of course, I could be
wrong.

Rather, I think that by using the multi-threaded runtime you will make your
application safe for multi-threading. With the single thread I expect that
you have, that should be a nit.
also, in order to compile the FORTRAN library and get it running with my
vc8 code, do I have to use the latest multi-threaded CRTs? or will any
version do (this is for rebuilding the FORTRAN library alone)?



As I said, I have to duck the Fortran questions because of my lack of
experience with it. Whose compiler are you using? And what does your library
do? If you post again, someone with Fortran knowledge may pop in. If no one
does, you might post again in

microsoft.public.vc.language

which I think sees a bit more traffic than this group.

Regards,
Will


这篇关于将Fortran库链接到VC8中的c ++代码时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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