- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
here is how i built a c lib using visual studio 2005.
File>NewProject>VisualC++>Win32>Win32 Console Application
under Win32 Application Wizard
ApplicationType:StaticLibrary
no precompiled header
I added a c file in "SourceFiles" and a h file in "Header File"
and compile to get a lib file.
Then for fortran part under visual studio 2005 again, I put the directory and lib file name info to "Linker>Input>AdditionalDependencies" under project properties.
then when i complie, i got
error_during_IPO_compilation: problem during multi-file optimization compilation (code 3)
was the procedure for c lib wrong?
or, calling c lib from fortran was not done right?
Please teach me on how to resolve this.
Many thanks well in advance.
S.Yoon
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
the following is the text i copied from BuildLog.htm
--------
Compiling with Intel Fortran Compiler 10.1.011 [IA-32]...
ifort /nologo /Zi /Od /gen-interfaces /warn:interfaces /module:"Debug\" /object:"Debug\" /traceback /check:bounds /libs:qwin /dbglibs /c /extfor:f /Qvc8 /Qlocation,link,"C:\Program Files\Microsoft Visual Studio 8\VC\bin" "C:\Documents and Settings\syoon\My Documents\My Fortran\EXAMPLE\hbcode1.f"
ifort /nologo /Zi /Od /gen-interfaces /warn:interfaces /module:"Debug\" /object:"Debug\" /traceback /check:bounds /libs:qwin /dbglibs /c /extfor:f /Qvc8 /Qlocation,link,"C:\Program Files\Microsoft Visual Studio 8\VC\bin" "C:\Documents and Settings\syoon\My Documents\My Fortran\EXAMPLE\f77_main.f"
Linking...
Link /OUT:"Debug\QWin1.exe" /INCREMENTAL:NO /NOLOGO /MANIFEST /MANIFESTFILE:"C:\Documents and Settings\syoon\My Documents\My Fortran\EXAMPLE\QWin1\QWin1\debug\qwin1.exe.intermediate.manifest" /DEBUG /PDB:"C:\Documents and Settings\syoon\My Documents\My Fortran\EXAMPLE\QWin1\QWin1\debug\qwin1.pdb" /SUBSYSTEM:WINDOWS C:\Documents and Settings\syoon\My Documents\My Fortran\EXAMPLE\lib_c\release\lib_c.lib "Debug\hbcode1.obj" "Debug\f77_main.obj"
backend signals
Severe: **Internal compiler error: internal abort** Please report this error along with the circumstances in which it occurred in a Software Problem Report. Note: File and line given may not be explicit cause of this error.
Link: error error_during_IPO_compilation: problem during multi-file optimization compilation (code 3)
Link: error error_during_IPO_compilation: problem during multi-file optimization compilation (code 3)
QWin1 - 2 error(s), 0 warning(s)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I see you are using a rather old compiler. Can you try this with 11.1.065? If it fails there, please attach a ZIP of the sources needed to reproduce this error.
You might try, as a possible workaround, turning off /warn:interface and /gen-interface. If I recall correctly, in 10.1 one of those was under External Procedures and the other under Diagnostics.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Unfortunately turning-off those two didnt work for my case.
i wonder calling a c lib from fortran is this difficult ori amdealing withabad c fileto be called from fortran?
thanks again for your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you try the 11.1 .065 compiler? We've fixed many bugs since 10.1.011.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
finally i got 11.0.061. (thats the version i have in cd)
i try it again and get a different warning.
---------------------------------------------------------------------
Linking...
Link /OUT:"Debug\QWin2.exe" /INCREMENTAL:NO /NOLOGO /MANIFEST /MANIFESTFILE:"C:\Documents and Settings\syoon\My Documents\My Fortran\EXAMPLE\QWin2\QWin2\debug\qwin2.exe.intermediate.manifest" /DEBUG /PDB:"C:\Documents and Settings\syoon\My Documents\My Fortran\EXAMPLE\QWin2\QWin2\debug\qwin2.pdb" /SUBSYSTEM:WINDOWS /IMPLIB:"C:\Documents and Settings\syoon\My Documents\My Fortran\EXAMPLE\QWin2\QWin2\debug\qwin2.lib" C:\Documents and Settings\syoon\My Documents\My Fortran\EXAMPLE\lib_c\release\lib_c.lib "Debug\f77_main.obj" "Debug\hbcode1.obj"
ipo: warning #11009: file format not recognized for C:\Documents
ipo: warning #11009: file format not recognized for and
ipo: warning #11009: file format not recognized for Settings\syoon\My
ipo: warning #11009: file format not recognized for Documents\My
Link: executing 'link'
LINK : fatal error LNK1181: cannot open input file 'C:\Documents.obj'
QWin2 - 1 error(s), 4 warning(s)
----------------------------------
then i moved the lib directory right under c:\
then i get the following
Compiling with Intel Fortran 11.0.061 [IA-32]...
ifort /nologo /debug:full /Od /I"C:\release" /gen-interfaces /warn:interfaces /module:"Debug\" /object:"Debug\" /traceback /check:bounds /libs:qwin /dbglibs /c /extfor:f /Qvc8 /Qlocation,link,"C:\Program Files\Microsoft Visual Studio 8\VC\bin" "C:\Documents and Settings\syoon\My Documents\My Fortran\EXAMPLE\f77_main.f"
ifort /nologo /debug:full /Od /I"C:\release" /gen-interfaces /warn:interfaces /module:"Debug\" /object:"Debug\" /traceback /check:bounds /libs:qwin /dbglibs /c /extfor:f /Qvc8 /Qlocation,link,"C:\Program Files\Microsoft Visual Studio 8\VC\bin" "C:\Documents and Settings\syoon\My Documents\My Fortran\EXAMPLE\hbcode1.f"
Linking...
Link /OUT:"Debug\QWin2.exe" /INCREMENTAL:NO /NOLOGO /LIBPATH:"C:\release" /MANIFEST /MANIFESTFILE:"C:\Documents and Settings\syoon\My Documents\My Fortran\EXAMPLE\QWin2\QWin2\debug\qwin2.exe.intermediate.manifest" /DEBUG /PDB:"C:\Documents and Settings\syoon\My Documents\My Fortran\EXAMPLE\QWin2\QWin2\debug\qwin2.pdb" /SUBSYSTEM:WINDOWS /IMPLIB:"C:\Documents and Settings\syoon\My Documents\My Fortran\EXAMPLE\QWin2\QWin2\debug\qwin2.lib" C:\release\lib_c.lib "Debug\f77_main.obj" "Debug\hbcode1.obj"
Link: executing 'link'
f77_main.obj : error LNK2019: unresolved external symbol _C_BRIDGE_PDGSSV referenced in function _MAIN__
Debug\QWin2.exe : fatal error LNK1120: 1 unresolved externals
QWin2 - 2 error(s), 0 warning(s)
---------------------------------------
do i need to try the exact version you mensioned before?
or i am assigning wrong directories for fortran compilation?
Thanks again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The second problem is that there is a reference to a routine named C_BRIDGE_PDGSSV that is not found. If this is in your C code, note that it must be spelled exactly like that, in upper case, unless you have added things to the Fortran code to change the case (such as an ATTRIBUTES ALIAS directive or BIND(C).)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
for fortran project,
Project>Properties>Linker>Input>Additional Dependencicies>C:\Documents and Settings\....\lib_c.lib
then i got the first error. did i put the path in the wrong place?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Another option is to add the library to the project as a "source file".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"unresolved external symbol _C_BRIDGE_PDGSSV referenced in function _MAIN__"
but,
in c, its written with lower letters and
...
c_bridge_pdgssv_(int *nprocs,......,int *info)
while in fortran, its again written in lower letters
call c_bridge_pdgssv(nprocs,........, info)
do i have to turn on/off some option in the project properties ?
---------------
I found this thread"Fortran Calling C Library" in this site,
and portion of the responce in the thread reads like
"Intel Fortran does not use _stdcall anymore (as CVF did), but _cdecl"
I dont know if its related to my case.
----------------
Am I going to add ##.c intoFortran Source files?
Since I got a "unresolved ..." error again when I put ##.c file into Soure Files.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
!DEC$ ATTRIBUTES DECORATE, ALIAS:"c_bridge_pdgssv" :: c_bridge_pdgssv
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Deleting intermediate files and output files for project 'QWin3', configuration 'Debug|Win32'. Compiling with Intel Fortran 11.0.061 [IA-32]... ifort /nologo /debug:full /Od /gen-interfaces /warn:interfaces /module:"Debug\" /object:"Debug\" /traceback /check:bounds /libs:qwin /dbglibs /c /extfor:f /Qvc8 /Qlocation,link,"C:\Program Files\Microsoft Visual Studio 8\VC\bin" "C:\Documents and Settings\syoon\My Documents\My Fortran\EXAMPLE\hbcode1.f" ifort /nologo /debug:full /Od /gen-interfaces /warn:interfaces /module:"Debug\" /object:"Debug\" /traceback /check:bounds /libs:qwin /dbglibs /c /extfor:f /Qvc8 /Qlocation,link,"C:\Program Files\Microsoft Visual Studio 8\VC\bin" "C:\Documents and Settings\syoon\My Documents\My Fortran\EXAMPLE\f77_main.f" C:\Documents and Settings\syoon\My Documents\My Fortran\EXAMPLE\f77_main.f(9): error #7794: Only a function or subroutine subprogram may have the !DEC$ ATTRIBUTES directive DECORATE specifier. [C_BRIDGE_PDG] !DEC$ ATTRIBUTES DECORATE, ALIAS:"c_bridge_pdgssv" :: c_bridge_pdgssv ------------------------------------------------------------^ compilation aborted for C:\Documents and Settings\syoon\My Documents\My Fortran\EXAMPLE\f77_main.f (code 1) QWin3 - 2 error(s), 0 warning(s) |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
!DEC$ ATTRIBUTES DECORATE :: c_bridge_pdgssv
!DEC$ ATTRIBUTES ALIAS:"c_bridge_pdgssv" :: c_bridge_pdgssv
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Compiling with Intel Fortran 11.0.061 [IA-32]... ifort /nologo /debug:full /Od /gen-interfaces /warn:interfaces /module:"Debug\" /object:"Debug\" /traceback /check:bounds /libs:qwin /dbglibs /c /extfor:f /Qvc8 /Qlocation,link,"C:\Program Files\Microsoft Visual Studio 8\VC\bin" "C:\Documents and Settings\syoon\My Documents\My Fortran\EXAMPLE\hbcode1.f" ifort /nologo /debug:full /Od /gen-interfaces /warn:interfaces /module:"Debug\" /object:"Debug\" /traceback /check:bounds /libs:qwin /dbglibs /c /extfor:f /Qvc8 /Qlocation,link,"C:\Program Files\Microsoft Visual Studio 8\VC\bin" "C:\Documents and Settings\syoon\My Documents\My Fortran\EXAMPLE\f77_main.f" Linking... Link /OUT:"Debug\QWin3.exe" /INCREMENTAL:NO /NOLOGO /MANIFEST /MANIFESTFILE:"C:\Documents and Settings\syoon\My Documents\My Fortran\EXAMPLE\QWin3\QWin3\debug\qwin3.exe.intermediate.manifest" /DEBUG /PDB:"C:\Documents and Settings\syoon\My Documents\My Fortran\EXAMPLE\QWin3\QWin3\debug\qwin3.pdb" /SUBSYSTEM:WINDOWS /IMPLIB:"C:\Documents and Settings\syoon\My Documents\My Fortran\EXAMPLE\QWin3\QWin3\debug\qwin3.lib" "C:\Documents and Settings\syoon\My Documents\My Fortran\EXAMPLE\lib_c\release\lib_c.lib" "Debug\hbcode1.obj" "Debug\f77_main.obj" Link: executing 'link' f77_main.obj : error LNK2019: unresolved external symbol _c_bridge_pdgssv referenced in function _MAIN__ Debug\QWin3.exe : fatal error LNK1120: 1 unresolved externals QWin3 - 2 error(s), 0 warning(s)
----
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Compiling with Intel Fortran 11.0.061 [IA-32]...
ifort /nologo /debug:full /Od /gen-interfaces /warn:interfaces /module:"Debug\" /object:"Debug\" /traceback /check:bounds /libs:qwin /dbglibs /c /extfor:f /Qvc8 /Qlocation,link,"C:\Program Files\Microsoft Visual Studio 8\VC\bin" "C:\Documents and Settings\syoon\My Documents\My Fortran\EXAMPLE\f77_main.f"
Linking...
Link /OUT:"Debug\QWin4.exe" /INCREMENTAL:NO /NOLOGO /LIBPATH:"C:\Documents and Settings\syoon\My Documents\My Fortran\EXAMPLE\lib_c\release" /MANIFEST /MANIFESTFILE:"C:\Documents and Settings\syoon\My Documents\My Fortran\EXAMPLE\QWin4\QWin4\debug\qwin4.exe.intermediate.manifest" /DEBUG /PDB:"C:\Documents and Settings\syoon\My Documents\My Fortran\EXAMPLE\QWin4\QWin4\debug\qwin4.pdb" /SUBSYSTEM:WINDOWS /IMPLIB:"C:\Documents and Settings\syoon\My Documents\My Fortran\EXAMPLE\QWin4\QWin4\debug\qwin4.lib" "C:\Documents and Settings\syoon\My Documents\My Fortran\EXAMPLE\lib_c\release\lib_c.lib" "Debug\hbcode1.obj" "Debug\f77_main.obj"
Link: executing 'link'
lib_c.lib(c_bridge_pdgssv.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
MSVCRT.lib(MSVCR80.dll) : error LNK2005: _printf already defined in LIBCMTD.lib(printf.obj)
MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in LIBCMTD.lib(typinfo.obj)
MSVCRT.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in LIBCMTD.lib(typinfo.obj)
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
lib_c.lib(c_bridge_pdgssv.obj) : error LNK2001: unresolved external symbol _intMalloc
lib_c.lib(c_bridge_pdgssv.obj) : error LNK2001: unresolved external symbol _get_perm_c
lib_c.lib(c_bridge_pdgssv.obj) : error LNK2001: unresolved external symbol _Destroy_SuperMatrix_Store
lib_c.lib(c_bridge_pdgssv.obj) : error LNK2001: unresolved external symbol _superlu_dQuerySpace
lib_c.lib(c_bridge_pdgssv.obj) : error LNK2001: unresolved external symbol _Destroy_CompCol_Matrix
lib_c.lib(c_bridge_pdgssv.obj) : error LNK2001: unresolved external symbol _sp_ienv
lib_c.lib(c_bridge_pdgssv.obj) : error LNK2001: unresolved external symbol _Destroy_SuperNode_Matrix
lib_c.lib(c_bridge_pdgssv.obj) : error LNK2001: unresolved external symbol _dCreate_CompCol_Matrix
lib_c.lib(c_bridge_pdgssv.obj) : error LNK2001: unresolved external symbol _pdgssv
lib_c.lib(c_bridge_pdgssv.obj) : error LNK2001: unresolved external symbol _superlu_free
lib_c.lib(c_bridge_pdgssv.obj) : error LNK2001: unresolved external symbol _dCreate_Dense_Matrix
Debug\QWin4.exe : fatal error LNK1120: 11 unresolved externals QWin4 - 15 error(s), 1 warning(s)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
First, you need to make sure that the "runtime library" settings in the Fortran and C projects are the same. Since you are using QuickWin in Fortran, there is no "QuickWin" setting in C, but the correct option there is
"Multithreaded (/MT)". Find that under "Code Generation". That will tyake care of the 2005 and 4098 messages.
The others are link errors internal to your C libray, where c_bridge_pdgssv is referencing other routines. Where are those defined, such as superlu_free and pdgssv?

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