- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a piece of Fortran code to link to a static library, but it seems there are some conflicts with default libraries. I'm working with Windows XP 64bit.
ifort test.f gass_cuda.lib C:\CUDA\lib\cuda.lib /us /Qlowercase -o test
Intel Visual Fortran Intel 64 Compiler Professional for applications runni
ng on Intel 64, Version 11.0 Build 20090318 Package ID: w_cprof_p_11.0.074
Copyright (C) 1985-2009 Intel Corporation. All rights reserved.
Microsoft Incremental Linker Version 8.00.50727.42
Copyright (C) Microsoft Corporation. All rights reserved.
-out:test.exe
-subsystem:console
test.obj
gass_cuda.lib
C:\CUDA\lib\cuda.lib
MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: free already defined in LIBCMT.lib(fr
ee.obj)
MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: strncpy already defined in LIBCMT.lib
(strncpy.obj)
MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: malloc already defined in LIBCMT.lib(
malloc.obj)
LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; u
se /NODEFAULTLIB:library
test.exe : fatal error LNK1169: one or more multiply defined symbols found
If I try to use the option /NODEAULTLIB it tells me that it is an unknown option:
ifort test.f gass_cuda.lib C:\CUDA\lib\cuda.lib /NODEFAULTLIB /us /Qlowercase -o test
Intel Visual Fortran Intel 64 Compiler Professional for applications runni
ng on Intel 64, Version 11.0 Build 20090318 Package ID: w_cprof_p_11.0.074
Copyright (C) 1985-2009 Intel Corporation. All rights reserved.
ifort: command line warning #10006: ignoring unknown option '/NODEFAULTLIB'
Microsoft Incremental Linker Version 8.00.50727.42
Copyright (C) Microsoft Corporation. All rights reserved.
-out:test.exe
-subsystem:console
test.obj
gass_cuda.lib
C:\CUDA\lib\cuda.lib
MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: free already defined in LIBCMT.lib(fr
ee.obj)
MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: strncpy already defined in LIBCMT.lib
(strncpy.obj)
MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: malloc already defined in LIBCMT.lib(
malloc.obj)
LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; u
se /NODEFAULTLIB:library
test.exe : fatal error LNK1169: one or more multiply defined symbols found
ifort test.f gass_cuda.lib C:\CUDA\lib\cuda.lib /us /Qlowercase -o test
Intel Visual Fortran Intel 64 Compiler Professional for applications runni
ng on Intel 64, Version 11.0 Build 20090318 Package ID: w_cprof_p_11.0.074
Copyright (C) 1985-2009 Intel Corporation. All rights reserved.
Microsoft Incremental Linker Version 8.00.50727.42
Copyright (C) Microsoft Corporation. All rights reserved.
-out:test.exe
-subsystem:console
test.obj
gass_cuda.lib
C:\CUDA\lib\cuda.lib
MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: free already defined in LIBCMT.lib(fr
ee.obj)
MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: strncpy already defined in LIBCMT.lib
(strncpy.obj)
MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: malloc already defined in LIBCMT.lib(
malloc.obj)
LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; u
se /NODEFAULTLIB:library
test.exe : fatal error LNK1169: one or more multiply defined symbols found
If I try to use the option /NODEAULTLIB it tells me that it is an unknown option:
ifort test.f gass_cuda.lib C:\CUDA\lib\cuda.lib /NODEFAULTLIB /us /Qlowercase -o test
Intel Visual Fortran Intel 64 Compiler Professional for applications runni
ng on Intel 64, Version 11.0 Build 20090318 Package ID: w_cprof_p_11.0.074
Copyright (C) 1985-2009 Intel Corporation. All rights reserved.
ifort: command line warning #10006: ignoring unknown option '/NODEFAULTLIB'
Microsoft Incremental Linker Version 8.00.50727.42
Copyright (C) Microsoft Corporation. All rights reserved.
-out:test.exe
-subsystem:console
test.obj
gass_cuda.lib
C:\CUDA\lib\cuda.lib
MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: free already defined in LIBCMT.lib(fr
ee.obj)
MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: strncpy already defined in LIBCMT.lib
(strncpy.obj)
MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: malloc already defined in LIBCMT.lib(
malloc.obj)
LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; u
se /NODEFAULTLIB:library
test.exe : fatal error LNK1169: one or more multiply defined symbols found
Link Copied
8 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Alessandro
I have a piece of Fortran code to link to a static library, but it seems there are some conflicts with default libraries. I'm working with Windows XP 64bit.
ifort test.f gass_cuda.lib C:CUDAlibcuda.lib /us /Qlowercase -o test
Intel Visual Fortran Intel 64 Compiler Professional for applications runni
ng on Intel 64, Version 11.0 Build 20090318 Package ID: w_cprof_p_11.0.074
Copyright (C) 1985-2009 Intel Corporation. All rights reserved.
Microsoft Incremental Linker Version 8.00.50727.42
Copyright (C) Microsoft Corporation. All rights reserved.
-out:test.exe
-subsystem:console
test.obj
gass_cuda.lib
C:CUDAlibcuda.lib
MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: free already defined in LIBCMT.lib(fr
ee.obj)
MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: strncpy already defined in LIBCMT.lib
(strncpy.obj)
MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: malloc already defined in LIBCMT.lib(
malloc.obj)
LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; u
se /NODEFAULTLIB:library
test.exe : fatal error LNK1169: one or more multiply defined symbols found
If I try to use the option /NODEAULTLIB it tells me that it is an unknown option:
ifort test.f gass_cuda.lib C:CUDAlibcuda.lib /NODEFAULTLIB /us /Qlowercase -o test
Intel Visual Fortran Intel 64 Compiler Professional for applications runni
ng on Intel 64, Version 11.0 Build 20090318 Package ID: w_cprof_p_11.0.074
Copyright (C) 1985-2009 Intel Corporation. All rights reserved.
ifort: command line warning #10006: ignoring unknown option '/NODEFAULTLIB'
Microsoft Incremental Linker Version 8.00.50727.42
Copyright (C) Microsoft Corporation. All rights reserved.
-out:test.exe
-subsystem:console
test.obj
gass_cuda.lib
C:CUDAlibcuda.lib
MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: free already defined in LIBCMT.lib(fr
ee.obj)
MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: strncpy already defined in LIBCMT.lib
(strncpy.obj)
MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: malloc already defined in LIBCMT.lib(
malloc.obj)
LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; u
se /NODEFAULTLIB:library
test.exe : fatal error LNK1169: one or more multiply defined symbols found
ifort test.f gass_cuda.lib C:CUDAlibcuda.lib /us /Qlowercase -o test
Intel Visual Fortran Intel 64 Compiler Professional for applications runni
ng on Intel 64, Version 11.0 Build 20090318 Package ID: w_cprof_p_11.0.074
Copyright (C) 1985-2009 Intel Corporation. All rights reserved.
Microsoft Incremental Linker Version 8.00.50727.42
Copyright (C) Microsoft Corporation. All rights reserved.
-out:test.exe
-subsystem:console
test.obj
gass_cuda.lib
C:CUDAlibcuda.lib
MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: free already defined in LIBCMT.lib(fr
ee.obj)
MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: strncpy already defined in LIBCMT.lib
(strncpy.obj)
MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: malloc already defined in LIBCMT.lib(
malloc.obj)
LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; u
se /NODEFAULTLIB:library
test.exe : fatal error LNK1169: one or more multiply defined symbols found
If I try to use the option /NODEAULTLIB it tells me that it is an unknown option:
ifort test.f gass_cuda.lib C:CUDAlibcuda.lib /NODEFAULTLIB /us /Qlowercase -o test
Intel Visual Fortran Intel 64 Compiler Professional for applications runni
ng on Intel 64, Version 11.0 Build 20090318 Package ID: w_cprof_p_11.0.074
Copyright (C) 1985-2009 Intel Corporation. All rights reserved.
ifort: command line warning #10006: ignoring unknown option '/NODEFAULTLIB'
Microsoft Incremental Linker Version 8.00.50727.42
Copyright (C) Microsoft Corporation. All rights reserved.
-out:test.exe
-subsystem:console
test.obj
gass_cuda.lib
C:CUDAlibcuda.lib
MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: free already defined in LIBCMT.lib(fr
ee.obj)
MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: strncpy already defined in LIBCMT.lib
(strncpy.obj)
MSVCRTD.lib(MSVCR80D.dll) : error LNK2005: malloc already defined in LIBCMT.lib(
malloc.obj)
LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; u
se /NODEFAULTLIB:library
test.exe : fatal error LNK1169: one or more multiply defined symbols found
I believe that /NODEFAULTLIB must be followed by a colon and the name of the libray you want to exclude (i.e. here, "/NODEFAULTLIB:MSVCRTD").
Alternatively, if you are working in Visual Studio, you can specify which library(ies) to exclude under the Project/Properties/Linker/Input menu.
Stephen.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - eos pengwern
I believe that /NODEFAULTLIB must be followed by a colon and the name of the libray you want to exclude (i.e. here, "/NODEFAULTLIB:MSVCRTD").
Alternatively, if you are working in Visual Studio, you can specify which library(ies) to exclude under the Project/Properties/Linker/Input menu.
Stephen.
I tried to use /NODEFAULTLIB:MSVCRTD or /NODEFAULTLIB:MSVCRTD.lib, but I keep on getting:
ifort: command line warning #10006: ignoring unknown option '/NODEFAULTLIB
or
ifort: command line warning #10006: ignoring unknown option '/NODEFAULTLIB:MSVCRTD.lib
I usually work in Visual Studio, but the people who gave me the library told me to compile with this command, and I do not know how to set Visual Studio to do the exact same thing. I first want to make the example work, and then I think I'll try to set Visual Studio to do it for me.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Alessandro
I tried to use /NODEFAULTLIB:MSVCRTD or /NODEFAULTLIB:MSVCRTD.lib, but I keep on getting:
ifort: command line warning #10006: ignoring unknown option '/NODEFAULTLIB
or
ifort: command line warning #10006: ignoring unknown option '/NODEFAULTLIB:MSVCRTD.lib
I usually work in Visual Studio, but the people who gave me the library told me to compile with this command, and I do not know how to set Visual Studio to do the exact same thing. I first want to make the example work, and then I think I'll try to set Visual Studio to do it for me.
Thank you.
It needs to be /NODEFAULTLIB:"msvcrtd.lib" - with quotes.
Les
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Les Neilson
It needs to be /NODEFAULTLIB:"msvcrtd.lib" - with quotes.
Les
It still does not understand the command:
ifort test.f gass_cuda.lib C:CUDAlibcuda.lib /NODEFAULTLIB:"msvcrtd.lib" /us /Qlowercase -o test
Intel Visual Fortran Intel 64 Compiler Professional for applications runni
ng on Intel 64, Version 11.0 Build 20090318 Package ID: w_cprof_p_11.0.074
Copyright (C) 1985-2009 Intel Corporation. All rights reserved.
ifort: command line warning #10006: ignoring unknown option '/NODEFAULTLIB:msvcr
td.lib'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Alessandro
It still does not understand the command:
ifort test.f gass_cuda.lib C:CUDAlibcuda.lib /NODEFAULTLIB:"msvcrtd.lib" /us /Qlowercase -o test
Intel Visual Fortran Intel 64 Compiler Professional for applications runni
ng on Intel 64, Version 11.0 Build 20090318 Package ID: w_cprof_p_11.0.074
Copyright (C) 1985-2009 Intel Corporation. All rights reserved.
ifort: command line warning #10006: ignoring unknown option '/NODEFAULTLIB:msvcr
td.lib'
This is a linker-only option, so it must come after /link switch. This should work:
ifort test.f gass_cuda.lib C:CUDAlibcuda.lib /us /Qlowercase -o test /link /NODEFAULTLIB:"msvcrtd.lib"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Jugoslav Dujic
This is a linker-only option, so it must come after /link switch. This should work:
ifort test.f gass_cuda.lib C:CUDAlibcuda.lib /us /Qlowercase -o test /link /NODEFAULTLIB:"msvcrtd.lib"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Jugoslav Dujic
This is a linker-only option, so it must come after /link switch. This should work:
ifort test.f gass_cuda.lib C:CUDAlibcuda.lib /us /Qlowercase -o test /link /NODEFAULTLIB:"msvcrtd.lib"
Thank you, now I'm able to build the application, with some warnings though. But I cannot execute the application, as it tells me:
"The system cannot execute the specified program".
Here it is what I get from ifort:
ifort test.f gass_cuda.lib C:CUDAlibcuda.lib /us /Qlowercase -o test /link /NODEFAULTLIB:"msvcrtd.lib"
Intel Visual Fortran Intel 64 Compiler Professional for applications runni
ng on Intel 64, Version 11.0 Build 20090318 Package ID: w_cprof_p_11.0.074
Copyright (C) 1985-2009 Intel Corporation. All rights reserved.
Microsoft Incremental Linker Version 8.00.50727.42
Copyright (C) Microsoft Corporation. All rights reserved.
-out:test.exe
-subsystem:console
/NODEFAULTLIB:msvcrtd.lib
test.obj
gass_cuda.lib
C:CUDAlibcuda.lib
gass_cuda.lib(cuda.obj) : warning LNK4217: locally defined symbol free imported
in function cudevicegetname_
gass_cuda.lib(cuda.obj) : warning LNK4217: locally defined symbol strncpy import
ed in function cudevicegetname_
gass_cuda.lib(cuda.obj) : warning LNK4217: locally defined symbol malloc importe
d in function cudevicegetname_
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Alessandro
Thank you, now I'm able to build the application, with some warnings though. But I cannot execute the application, as it tells me:
"The system cannot execute the specified program".

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