Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29251 Discussions

fatal error LNK1104: cannot open file 'LIBC.lib'

Brian_A_
Novice
3,655 Views
LINK : fatal error LNK1104: cannot open file 'LIBC.lib'
I am getting this error when trying to compile. If I use -nodefaultlibs:libc.lib, I get a whole bunch of unresolved errors relating to libcmt.lib.
This is my ifort command.
ifort -nologo $(FFLAGS) $(FPSTOP) $(FL) \\
-thread -dbglibs relap\\relap5.$O -libs:qwin lib\\relap$(NM).lib \\
lib\\scdap$(NM).lib lib\\contmn$(NM).lib lib\\matpro$(NM).lib \\
lib\\envrl$(NM).lib lib\\graphics.lib lib\\filechck.lib \\
lib\\opengl32.lib lib\\glaux.lib lib\\glu32.lib lib\\f90gl.lib \\
lib\\f90glu.lib lib\\f90glut.lib lib\\glut32.lib \\
-exe:bin\\relap5.exe
I am compiling on Win7 using IFC 12.0.4.196 Build 20110427
0 Kudos
1 Solution
Steven_L_Intel1
Employee
3,655 Views
The problem here is the -nodefaultlib - this tells the linker to ignore all the compiler directives on which libraries to use. This program needs the QuickWin libraries so all the sources need to be compiled with /libs:qwin and -nodefaultlib removed. Or, add libifqwin.lib to the library set, but you'll probably need more than that.

View solution in original post

0 Kudos
14 Replies
Steven_L_Intel1
Employee
3,655 Views
One of the libraries you are linking to was built with Visual Studio 2003 or earlier. Microsoft dropped libc.lib as of VS2005. You will need to recompile whatever library is making the reference to libc.lib. I will also note that Microsoft dropped glaux.lib as of VS2008.
0 Kudos
Brian_A_
Novice
3,655 Views
None of the librarys in the ifort command were built with the MSVS2003.
$(f90) -nologo $(FFLAGS) $(FPSTOP) $(FL) -libs:qwin \
-thread -dbglibs relap\relap5.$O lib\relap$(NM).lib \
lib\scdap$(NM).lib lib\contmn$(NM).lib lib\matpro$(NM).lib \
lib\envrl$(NM).lib lib\graphics.lib lib\filechck.lib \
lib\opengl32.lib lib\glu32.lib lib\f90gl.lib lib\f90glu.lib \
lib\f90glut.lib lib\glut32.lib -exe:bin\relap5.exe

These are built when I compile:
lib\scdap$(NM).lib lib\contmn$(NM).lib lib\matpro$(NM).lib lib\envrl$(NM).lib lib\graphics.liblib\relap$(NM).lib

These ones are from the latest f90gl download
lib\f90glut.lib lib\glut32.lib lib\opengl32.lib lib\glu32.lib lib\f90gl.lib lib\f90glu.lib
This one is build using the command: makilib filechck.dll
lib\filechck.lib
0 Kudos
Brian_A_
Novice
3,655 Views
Not sure if the previous post is showing up.
0 Kudos
Steven_L_Intel1
Employee
3,655 Views
Add at the end of the command that does the linking:

/link /verbose:libs

Do the link (it will probably be a lot of output so redirect it to a file) and attach the output.
0 Kudos
Brian_A_
Novice
3,655 Views
I have attached the output.
0 Kudos
Steven_L_Intel1
Employee
3,655 Views
It's f90glut.lib that is the problem. The version I posted most recently (also attached here) doesn't do that.
0 Kudos
Brian_A_
Novice
3,655 Views
Ok so I got the g90glut files fixed, and now I am getting a lot of unresolved external symbols. See attached file.
0 Kudos
bmchenry
New Contributor II
3,655 Views
biding my time while waiting for acomplete rebuild of large project (zzzzzz) so took a quick look..

1) you need to fix name relap\relap5.o...is is .obj?

2) your graphics.lib references a number of external procedures, maybe they're are they in relap5??
I'd guess that'syour 'main program' since one of the errors is it can't find you 'main' program...

there's a couple of things to fix

from another brian

0 Kudos
TimP
Honored Contributor III
3,655 Views
Quoting bmchenry

1) you need to fix name relap\relap5.o...is is .obj?

It's OK to use .o naming, except that .o may indicate the object file is incompatible in some way (e.g. built for linux, or to link against a different run-time library, such as cygwin). You wouldn't normally mix .o and .obj conventions.
0 Kudos
Brian_A_
Novice
3,655 Views
THe .o is for our optimized version and the .obj is for our debug version. Our code is all built from a command line. We doo not use VS to build our application.
0 Kudos
Brian_A_
Novice
3,655 Views
relap5 is our main program, any ideas on what to do?
0 Kudos
TimP
Honored Contributor III
3,655 Views
If your build procedure is set up to substitute .obj for $O, check why that didn't occur when that one was compiled originally. This is not a common idiom, so you need to investigate your procedure.
0 Kudos
Brian_A_
Novice
3,655 Views
the $O gets set to either .o or .obj depending on if I am compiling a optimized version or a debug version. I am compiling a optimized version. so the file relap5.$O is changed to .o
0 Kudos
Steven_L_Intel1
Employee
3,656 Views
The problem here is the -nodefaultlib - this tells the linker to ignore all the compiler directives on which libraries to use. This program needs the QuickWin libraries so all the sources need to be compiled with /libs:qwin and -nodefaultlib removed. Or, add libifqwin.lib to the library set, but you'll probably need more than that.
0 Kudos
Reply