- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Up front, I am a 'newbie' to the Intel Visual Fortran Compiler and am facing the 'learning curve...'
I am trying to compile a simple test code; and get the following errors as a partial example.
I have the file IFORT.CFG in the same subdirectory as IFORT.EXE and my test code.
I am setting the PATH, LIB, INCLUDE in the .CFG using the SET command.
Thanks for advice on resolving this.
Microsoft Incremental Linker Version 10.00.40219.01
Copyright (C) Microsoft Corporation. All rights reserved.
-out:TESTCODE.exe
-subsystem:console
TESTCODE.obj
TESTCODE.obj : error LNK2019: unresolved external symbol ___intel_new_proc_init referenced in function _MAIN__
TESTCODE.obj : error LNK2019: unresolved external symbol _for_set_reentrancy referenced in function _MAIN__
TESTCODE.obj : error LNK2019: unresolved external symbol _for_write_seq_fmt referenced in function _MAIN__
TESTCODE.obj : error LNK2019: unresolved external symbol _for_read_seq_fmt referenced in function _MAIN__
TESTCODE.obj : error LNK2019: unresolved external symbol _for_stop_core referenced in function _MAIN__
LIBCMT.lib(crt0.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
LIBCMT.lib(crt0.obj) : error LNK2019: unresolved external symbol __imp__GetCommandLineA@0 referenced in function ___tmainCRTStartup
LIBCMT.lib(crt0.obj) : error LNK2019: unresolved external symbol __imp__HeapSetInformation@16 referenced in function ___tmainCRTStartup
LIBCMT.lib(unhandld.obj) : error LNK2019: unresolved external symbol __imp__SetUnhandledExceptionFilter@4 referenced in function ___CxxSetUnhandledExceptionFilter
LIBCMT.lib(invarg.obj) : error LNK2001: unresolved external symbol __imp__SetUnhandledExceptionFilter@4
LIBCMT.lib(gs_report.obj) : error LNK2001: unresolved external symbol __imp__SetUnhandledExceptionFilter@4
LIBCMT.lib(crt0dat.obj) : error LNK2019: unresolved external symbol __imp__GetProcAddress@8 referenced in function ___crtCorExitProcess
LIBCMT.lib(tidtable.obj) : error LNK2001: unresolved external symbol __imp__GetProcAddress@8
continues on with additional LIBCMT 'unresolved externals....'
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How do you start your command session and what does your ifort command look like? Did you say you made a copy of ifort.exe?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
To directly answer your questions:
I placed a copy of the IFORT.EXE into a subdirectory; along with IFORT.CFG; IFORTVARS.BAT; and also COMPILERVARS.BAT; along with my simple FORTRAN file TESTCODE.FOR
I run the Intel Batch Files; and then type IFORT TESTCODE.FOR and then get the resulting errors posted earlier.
I have these installed: Microsoft Visual Studio 2010 Shell
Intel Visual Fortran
My 'larger picture' is this:
I have been working with some Fortran code which I can successfully compile using the MS Visual Studio shell and Intel Fortran. However, I can not successfully 'link' with a static library developed by another agency (using Intel compiler). This Library is composed of hundreds of subroutines, in both Fortran and C/C++; and since I don't have a C/C++ compiler its not possible for me to compile the code I need from the library directly for my application.
The other agency does not use the above shells; but rather compiles from the Command Line directly. So I have been trying to compile my piece of code from the Command Line and try to link with their library through this process; using the same options that the other agency uses.
However, I can not even create a simple executable using the Command Line procedure.
My 'other option' is to 'link' with the other agency's Library through the Shell; which I have been unsuccessful at.
Any feedback on this situation is appreciated.
I have placed the Library I desire to link with in about every Intel subdirectory which looks logical; as well as in ones I have created myself.
Is there a special procedure to invoke the use of this external static Library??
What about setting all the options the other agency used when developing their library??
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ifort testcode.for mylib.lib
If you need to specify a path to the library, do it on the ifort line.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How is the 'linking' to the static library done correctly within the Microsoft Visual Studio shell??
I have placed my desired external static library in several locations on the computer; and can not get the library to link with my code created from within the Microsoft Visual Studio / Intel Fortran shell.
I can not get the library's presence to be known to the shell; and I get 'unresolved externals' during this build process.
If I can do this linking with the static library, I can do away with the need to even compile from the Command Line.
Thanks again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Another way is to add the full path to the .lib to the project property Linker > Input > Additional Dependencies.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Previous to posting on this forum, I had already added the .LIB to the Project as a 'source file,' as you suggested. No luck with doing this....
I think the issue is related to the 'options' used by the other agency to create the .LIB file.
I will work further tomorrow; and perhaps post an example of the 'command line options' used to create the .LIB by the other agency.
Thanks again....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Below is an example of the Commands used by the third party to create the Library I am trying to link to:
Example of Fortran compile for Library creation:
ifort /c /nologo /MT /names:lowercase /iface:cref /assume:underscore /Ifortran_include /O2 /debug:none /Forelease64\bits.obj dc\bits.f
ifort /c /nologo /MT /names:lowercase /iface:cref /assume:underscore /Ifortran_include /O2 /debug:none /Forelease64\dcdltr.obj dc\dcdltr.f
ifort /c /nologo /MT /names:lowercase /iface:cref /assume:underscore /Ifortran_include /O2 /debug:none /Forelease64\dcinfo.obj dc\dcinfo.f
.... many more similar lines deleted.....
Example of C/C++ compile for Library creation:
cl /nologo /c /O2 /MT /Forelease64\catsort.obj system\catsort.c
cl /nologo /c /O2 /MT /Forelease64\chmodf.obj system\chmodf.c
cl /nologo /c /O2 /MT /Forelease64\closf.obj system\closf.c
cl /nologo /c /O2 /MT /Forelease64\filesort.obj system\filesort.c
..... many more similar lines deleted....
Example of Lib creation:
lib /nologo /out:release64\heclib.lib release64\bits.obj release64\dcdltr.obj release64\dcinfo.obj release64\dcreal.obj release64\dcrept.obj release64\dcsd3r.obj release64\dhchek.obj release64\dhinfo.obj release64\dhinit.obj release64\dmreal.obj release64\dudltr.obj release64\dureal.obj release64\durept.obj release64\dusd3r.obj release64\prtary.obj .....many more similar lines deleted....
Example of Link:
link /nologo /dll /out:release64\heclib.dll User32.lib Gdi32.lib release64\bits.obj release64\dcdltr.obj release64\dcinfo.obj release64\dcreal.obj release64\dcrept.obj release64\dcsd3r.obj release64\dhchek.obj release64\dhinfo.obj release64\dhinit.obj release64\dmreal.obj release64\dudltr.obj release64\dureal.obj release64\durept.obj release64.....many more similar lines deleted......
Note: the result of the above process is the creation of a Static Library;
Made by a 'third party.'
I would like to link my code to this Library but can not get the Library
to be recognized.....
I get 'external errors' when trying to create my .EXE (using the Microsoft/Intel Shell)
I can not get code to compile from the Command Line from my machine; as discussed earlier here....
Thanks in advance for advice/assistance on this.....
I would especially like to learn 'what switches' need to be set in the Microsoft /Intel Shell; and 'exactly where' I should do this.....
Again, I am a 'newbie' to the Microsoft/Intel shell....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You write, "Note: the result of the above process is the creation of a Static Library;". This is not the case - the link line you showed creates a DLL. It should also create a .LIB that is the "import library" for that DLL - this is what you link against.
You've left out a lot here, so it's hard to know exactly what the problem is. Let's start out slow. Go into Visual Studio, create a new Fortran Console application "with sample code". This gets you a "Hello World" program. Build that and run it - does it work?
Are you trying to build your program in a Visual Studio project? Please attach the buildlog.htm from the Debug or Release folder as well as the project's .vfproj file from the project that fails to build. Maybe it will be clearer then what is happening.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have both a .DLL and a .LIB which were constructed by the third party; I sent the information earlier used for the build of the DLL; my mistake.
Yes, I am building the program in a Visual Studio Project.
The 'missing externals' should be in the two libraries (a DLL and a LIB) which I have included in the Project; but I can't get the libraries to be recognized.
Thanks for comments made.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You showed the commands used to compile the sources in this library. These included /names:lowercasse and /assume:underscore. Those are conventions for UNIX/Linux and are different from the default conventions for Intel Fortran on Windows. The mismatch results in the routines not being found.
I suppose the simplest approach, though one I don't like, is to add those same options to your compiles. In your Fortran project, go to the External Procedures property page. Change "Name Case Interpretation" to "Lower Case" and "Append Underscore to External Names" to "Yes", then rebuild.
My preference would be to write interface blocks for these routines that specify BIND(C,NAME="name_") for each one, but that is a lot of work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In addition to your suggestions above, I had to change a setting to "Ignore all Default Libraries" to get around some issues between Libraries.
I've attached the latest BUILDLOG and .VFPROJ files.
I think things are improving but still issues are present.
Thanks again for feedback.
Should I 'delete' previous BUILDLOGs and .VFPROJ files before sending a new message??
- 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
I will contact the third party who compiled the Library I am trying to use. It is composed of both FORTRAN and C/C++ constructed items.
I am only working with FORTRAN and trying to link with and use this third party library.....
Thanks again.
- 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
The only piece of code I have done myself is the Sumhydin.f90 Fortran file.
The Library itself was created by a third party; using Intel compiler; the Library was constructed from the 'Command Line' rather than from the Visual Studio Interface (as I understand from the library builder). It contains both Fortran and C/C++ code.
My piece of code calls routines from the Library.
Thanks again.

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