- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am attempting to link a C++ library to Fortran. ADS_10p6.lib is a library I compiled from Microsoft Visual C++ .NET 2003 and I am using a Fortran code to call functions in that library. I am using Compaq Visual Fortran, not Intel, but this site is where I was told I could find support for CVF. I think that CVF is not compatible with Microsoft Visual C++ .NET 2003 and thats why Im getting errors, but I'm not 100% sure that's the problem.
I get the following errors when I compile the Fortran code:
ADS_10p6.lib(Ad_sensor.obj) : error LNK2001: unresolved external symbol __RTC_Shutdown
ADS_10p6.lib(Ad_sensor.obj) : error LNK2001: unresolved external symbol __RTC_InitBase
ADS_10p6.lib(Ad_sensor.obj) : error LNK2001: unresolved external symbol __RTC_CheckEsp
ADS_10p6.lib(Ad_sensor.obj) : error LNK2001: unresolved external symbol __RTC_UninitUse
What can I do to resolve these errors?
I also getthe follwingwarning that may have something to do with the errors:
LINK : warning LNK4098: defaultlib "LIBCD" conflicts with use of other libs; use /NODEFAULTLIB:library
Thank you.
I am attempting to link a C++ library to Fortran. ADS_10p6.lib is a library I compiled from Microsoft Visual C++ .NET 2003 and I am using a Fortran code to call functions in that library. I am using Compaq Visual Fortran, not Intel, but this site is where I was told I could find support for CVF. I think that CVF is not compatible with Microsoft Visual C++ .NET 2003 and thats why Im getting errors, but I'm not 100% sure that's the problem.
I get the following errors when I compile the Fortran code:
ADS_10p6.lib(Ad_sensor.obj) : error LNK2001: unresolved external symbol __RTC_Shutdown
ADS_10p6.lib(Ad_sensor.obj) : error LNK2001: unresolved external symbol __RTC_InitBase
ADS_10p6.lib(Ad_sensor.obj) : error LNK2001: unresolved external symbol __RTC_CheckEsp
ADS_10p6.lib(Ad_sensor.obj) : error LNK2001: unresolved external symbol __RTC_UninitUse
What can I do to resolve these errors?
I also getthe follwingwarning that may have something to do with the errors:
LINK : warning LNK4098: defaultlib "LIBCD" conflicts with use of other libs; use /NODEFAULTLIB:library
Thank you.
Link Copied
40 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I suppose you have the default cdecl calling convention on the C compatible side, which conflicts with the modified stdcall convention of CVF. If you wish to use CVF, you would use the old style __stdcall declarations for C, with attention to CVF conventions for character strings and the like. You would still need one of the options on the CVF side to support mixed case symbols, which of course was not done in the Fortran 2003 manner.
LIBCD is a different issue, I suppose indicating that you have compiled various objects with differing implied math libraries. Back then, besides the current choice of debug vs. release, there were multithread and non-thread-safe libraries.
How much effort do you wish to invest developing according to obsolete conventions with unsupported tools?
LIBCD is a different issue, I suppose indicating that you have compiled various objects with differing implied math libraries. Back then, besides the current choice of debug vs. release, there were multithread and non-thread-safe libraries.
How much effort do you wish to invest developing according to obsolete conventions with unsupported tools?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - tim18
I suppose you have the default cdecl calling convention on the C compatible side, which conflicts with the modified stdcall convention of CVF. If you wish to use CVF, you would use the old style __stdcall declarations for C, with attention to CVF conventions for character strings and the like. You would still need one of the options on the CVF side to support mixed case symbols, which of course was not done in the Fortran 2003 manner.
LIBCD is a different issue, I suppose indicating that you have compiled various objects with differing implied math libraries. Back then, besides the current choice of debug vs. release, there were multithread and non-thread-safe libraries.
How much effort do you wish to invest developing according to obsolete conventions with unsupported tools?
LIBCD is a different issue, I suppose indicating that you have compiled various objects with differing implied math libraries. Back then, besides the current choice of debug vs. release, there were multithread and non-thread-safe libraries.
How much effort do you wish to invest developing according to obsolete conventions with unsupported tools?
Thanks for your reply. I read about the __cdecl convention and I checked my C code for it, but it turns out that it is using __stdcall. So I don't think that's the issue... This is a very old code and I'm just trying to get it to build on CVF. I don't have any other fortran compilers yet so I'd like to get as far as I can with CVF.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - dktseng
Hi,
I am attempting to link a C++ library to Fortran. ADS_10p6.lib is a library I compiled from Microsoft Visual C++ .NET 2003 and I am using a Fortran code to call functions in that library. I am using Compaq Visual Fortran, not Intel, but this site is where I was told I could find support for CVF. I think that CVF is not compatible with Microsoft Visual C++ .NET 2003 and thats why Im getting errors, but I'm not 100% sure that's the problem.
I get the following errors when I compile the Fortran code:
ADS_10p6.lib(Ad_sensor.obj) : error LNK2001: unresolved external symbol __RTC_Shutdown
ADS_10p6.lib(Ad_sensor.obj) : error LNK2001: unresolved external symbol __RTC_InitBase
ADS_10p6.lib(Ad_sensor.obj) : error LNK2001: unresolved external symbol __RTC_CheckEsp
ADS_10p6.lib(Ad_sensor.obj) : error LNK2001: unresolved external symbol __RTC_UninitUse
What can I do to resolve these errors?
I also getthe follwingwarning that may have something to do with the errors:
LINK : warning LNK4098: defaultlib "LIBCD" conflicts with use of other libs; use /NODEFAULTLIB:library
Thank you.
I am attempting to link a C++ library to Fortran. ADS_10p6.lib is a library I compiled from Microsoft Visual C++ .NET 2003 and I am using a Fortran code to call functions in that library. I am using Compaq Visual Fortran, not Intel, but this site is where I was told I could find support for CVF. I think that CVF is not compatible with Microsoft Visual C++ .NET 2003 and thats why Im getting errors, but I'm not 100% sure that's the problem.
I get the following errors when I compile the Fortran code:
ADS_10p6.lib(Ad_sensor.obj) : error LNK2001: unresolved external symbol __RTC_Shutdown
ADS_10p6.lib(Ad_sensor.obj) : error LNK2001: unresolved external symbol __RTC_InitBase
ADS_10p6.lib(Ad_sensor.obj) : error LNK2001: unresolved external symbol __RTC_CheckEsp
ADS_10p6.lib(Ad_sensor.obj) : error LNK2001: unresolved external symbol __RTC_UninitUse
What can I do to resolve these errors?
I also getthe follwingwarning that may have something to do with the errors:
LINK : warning LNK4098: defaultlib "LIBCD" conflicts with use of other libs; use /NODEFAULTLIB:library
Thank you.
Yes, you definitely have a library problem.
These undefineds belong to C, and are probably new in VS 2003.
If you are using CVF to link, your LIB environment variable probably points to a VC98 directory first; possibly it only points to VC98 directories.
You'll need to adjust your LIB environment variable to put the VS2003 directories first, and then try linking.
Now, to get rid of the other message, that LIBCD conflicts with other libraries, will take a little more investigation.
Pick any of the object files from ADS_10p6 library. From the command line, issue the command:
link -dump -directives objectname.obj
You should see a number of "-defaultlib:XX" lines, and one of them will list the C library name. I'm going to assume libcd.lib will NOT be in that list :-)
You can post the list of defaultlibs, and we can give you guidance on configuration changes for your CVF project
A better longterm solution would be if I can get Steve to post a pointer to an old CVF newsletter article I wrote on how to reconcile your C libraries, and you can resolve this and any other similar problems.
- Lorri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Lorri Menard (Intel)
Yes, you definitely have a library problem.
These undefineds belong to C, and are probably new in VS 2003.
If you are using CVF to link, your LIB environment variable probably points to a VC98 directory first; possibly it only points to VC98 directories.
You'll need to adjust your LIB environment variable to put the VS2003 directories first, and then try linking.
Now, to get rid of the other message, that LIBCD conflicts with other libraries, will take a little more investigation.
Pick any of the object files from ADS_10p6 library. From the command line, issue the command:
link -dump -directives objectname.obj
You should see a number of "-defaultlib:XX" lines, and one of them will list the C library name. I'm going to assume libcd.lib will NOT be in that list :-)
You can post the list of defaultlibs, and we can give you guidance on configuration changes for your CVF project
A better longterm solution would be if I can get Steve to post a pointer to an old CVF newsletter article I wrote on how to reconcile your C libraries, and you can resolve this and any other similar problems.
- Lorri
Thanks for your reply Lorri. So how do I go about adjusting my LIB environment variable in CVF? I'm pretty new to CVF and not very familar with it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - dktseng
Thanks for your reply Lorri. So how do I go about adjusting my LIB environment variable in CVF? I'm pretty new to CVF and not very familar with it.
Let me assume that you're asking about the DevStudio interface (because if you're using the command line, it would be the same no matter what application you were using).
Go to menu itemTools->Options, then the Directories tab. Select "Show directories for:" and set it to Library Files.
Add the VS2003 library directories, and move them above the VC98 directory.
If you don't know the VS2003 library directory, go to Start->All programs->Microsoft Visual Studio .NET 2003-> Tools ->Command prompt
In that command prompt issue:
echo %lib%
That will display the LIB environment variable, as set for VS2003.
- Lorri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I will admit some level of skepticism that this will work. The mechanics as Lorri describes them are fine, but I think there may still be link errors combining the CVF libraries with the VC2003 libraries. I have vague memories of other reports of problems doing this.
I do recommend that you do any linking in the VC2003 environment, using the 2003 linker and not the VC98 linker that CVF provides.
I do recommend that you do any linking in the VC2003 environment, using the 2003 linker and not the VC98 linker that CVF provides.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Lorri Menard (Intel)
Let me assume that you're asking about the DevStudio interface (because if you're using the command line, it would be the same no matter what application you were using).
Go to menu itemTools->Options, then the Directories tab. Select "Show directories for:" and set it to Library Files.
Add the VS2003 library directories, and move them above the VC98 directory.
If you don't know the VS2003 library directory, go to Start->All programs->Microsoft Visual Studio .NET 2003-> Tools ->Command prompt
In that command prompt issue:
echo %lib%
That will display the LIB environment variable, as set for VS2003.
- Lorri
Okay, now I get these errors saying that some of the .obj files defined VC98 libraryare already defined in theVS2003library. How do I get around that?
LIBCD.lib(dbgheap.obj) : error LNK2005: _malloc already defined in libcmt.lib(malloc.obj)
LIBCD.lib(dbgheap.obj) : error LNK2005: __nh_malloc already defined in libcmt.lib(malloc.obj)
LIBCD.lib(dbgheap.obj) : error LNK2005: __heap_alloc already defined in libcmt.lib(malloc.obj)
.
.
.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Steve Lionel (Intel)
I will admit some level of skepticism that this will work. The mechanics as Lorri describes them are fine, but I think there may still be link errors combining the CVF libraries with the VC2003 libraries. I have vague memories of other reports of problems doing this.
I do recommend that you do any linking in the VC2003 environment, using the 2003 linker and not the VC98 linker that CVF provides.
I do recommend that you do any linking in the VC2003 environment, using the 2003 linker and not the VC98 linker that CVF provides.
How would I go about using the 2003 linker? I will be calling C++ functions in CVF, so doesn't that mean I have to link the VC2003 libraries from CVF?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You've already posted the suggestion of the link option /nodefaultlib:libcd.lib which would accept the resolution of libc functions by the VS2003 library rather than VC98. If you want debug, you can arrange that libcmd is used rather than libcmt. You don't have many options, given that you want to mix VC98 and VS2003.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The way of resolving the libcd/libcmt issue in my opinion would be to specify the multithread static, non-debug libraries in CVF and make sure that the VC2003 project is set to use the same. I consider /ignorelibs to be the absolutely last resort, and for C/C++ code it often does not work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - tim18
You've already posted the suggestion of the link option /nodefaultlib:libcd.lib which would accept the resolution of libc functions by the VS2003 library rather than VC98. If you want debug, you can arrange that libcmd is used rather than libcmt. You don't have many options, given that you want to mix VC98 and VS2003.
That worked. And I had to uncheck the "Generate Debug Info" box to get rid of the last error. How do I arrange that libcmd is used and not libcmt? Do you mean libcmtd because I don't see a libcmd.lib in my folder?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - dktseng
That worked. And I had to uncheck the "Generate Debug Info" box to get rid of the last error. How do I arrange that libcmd is used and not libcmt? Do you mean libcmtd because I don't see a libcmd.lib in my folder?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Lorri Menard (Intel)
Yes, you definitely have a library problem.
These undefineds belong to C, and are probably new in VS 2003.
If you are using CVF to link, your LIB environment variable probably points to a VC98 directory first; possibly it only points to VC98 directories.
You'll need to adjust your LIB environment variable to put the VS2003 directories first, and then try linking.
Now, to get rid of the other message, that LIBCD conflicts with other libraries, will take a little more investigation.
Pick any of the object files from ADS_10p6 library. From the command line, issue the command:
link -dump -directives objectname.obj
You should see a number of "-defaultlib:XX" lines, and one of them will list the C library name. I'm going to assume libcd.lib will NOT be in that list :-)
You can post the list of defaultlibs, and we can give you guidance on configuration changes for your CVF project
A better longterm solution would be if I can get Steve to post a pointer to an old CVF newsletter article I wrote on how to reconcile your C libraries, and you can resolve this and any other similar problems.
- Lorri
Someone told me that if I disable CLR in .NET 2003, then I will not need to link the .NET 2003 libraries when I run my CVF code. Is that true? If so, how do I disable CLR in MVS .NET 2003? What is CLR and what does it do?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Whoever told you that is confused. CLR is the Common Language Runtime environment for .NET applications. Your CVF code isn't using it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Steve Lionel (Intel)
Whoever told you that is confused. CLR is the Common Language Runtime environment for .NET applications. Your CVF code isn't using it.
LOL. So I'll need the .NET libraries even if I disable CLR? He either said CLR or CRL. Does CRL stand for something?
He said that if I remove the .NET framework, then I won't need the .NET libraries... I'm not sure what that means.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No, you don't need .NET libraries. Ignore what this guy told you.
Is the current problem that you have undefined references to the _RTC_xxx symbols?
These are MSVC debugging library routines. Your C++ code was built with certain debugging features enabled, such as /RTC1. If so, it requires that you link against the C++ debug libraries.
Is the current problem that you have undefined references to the _RTC_xxx symbols?
These are MSVC debugging library routines. Your C++ code was built with certain debugging features enabled, such as /RTC1. If so, it requires that you link against the C++ debug libraries.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Steve Lionel (Intel)
No, you don't need .NET libraries. Ignore what this guy told you.
Is the current problem that you have undefined references to the _RTC_xxx symbols?
These are MSVC debugging library routines. Your C++ code was built with certain debugging features enabled, such as /RTC1. If so, it requires that you link against the C++ debug libraries.
Is the current problem that you have undefined references to the _RTC_xxx symbols?
These are MSVC debugging library routines. Your C++ code was built with certain debugging features enabled, such as /RTC1. If so, it requires that you link against the C++ debug libraries.
Yes, this problem is referenced to the RTC_xxx symbols. I'm having trouble linking the C++ libraries I have created in .NET. However, after following the suggestions on this thread and linking the .NETdirectories in CVF Iwas able to get rid of the errors regarding RTC_xxx. I can't link my C++ libraries without the .NET directories linked the way Lorri told me. What the guy told me was that I won't need the .NET directories if I disable CLR. Is that true? If so, how do I disable it?
How would I turn the debugging features in .NET off so that when I build my C++ library and call it in CVF, I won't get the RTC errors?
My other question is that I just recently got the Intel fortran compiler. How do I link a C++ library compiled in .NET to my fortran code using the Intel compiler?
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think you may be assuming that any C code compiled in "Visual C++ 2003 .NET" is .NET code. That is not correct, and Microsoft realized the confusion and removed .NET from the product name as of Visual Studio 2005. One can't create a "C++ library compiled in .NET" - if it is a .NET application, there is no compiled object code. I suggest you forget the names ".NET" and "CLR".
It is likely that your C++ code is in a normal static library, in a "Win32 project". If you're properly linking to the VC-supplied libraries, those symbols should be defined. If you want, try setting the C++ option Code Generation > Basic Runtime Checks to Default.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Steve Lionel (Intel)
I think you may be assuming that any C code compiled in "Visual C++ 2003 .NET" is .NET code. That is not correct, and Microsoft realized the confusion and removed .NET from the product name as of Visual Studio 2005. One can't create a "C++ library compiled in .NET" - if it is a .NET application, there is no compiled object code. I suggest you forget the names ".NET" and "CLR".
It is likely that your C++ code is in a normal static library, in a "Win32 project". If you're properly linking to the VC-supplied libraries, those symbols should be defined. If you want, try setting the C++ option Code Generation > Basic Runtime Checks to Default.
The Basic Runtime Checks were already set to default when I compiled it... I don't understand why I need the .NET libraries linked in CVF to be able to get rid of those RTC errors when I link my C++ library.
How do I link my C++ library in the Intel fortran compiler? I just got the Intel compiler.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do you also have Microsoft Visual C++ installed? Mixed-language development is not supported unless you do. However, if you do, it should be sufficient to add the C++ compiled library to your Fortran project as if it were a source file.
I don't understand what you mean by ".NET libraries" - there is no such thing.

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