[Ipopt] libc.lib

Stefan Vigerske stefan at vigerske.de
Sat Oct 18 11:19:45 EDT 2008


Hi,

> I use the visual studio 2005 to compile the IPOPT, and I get a link error:
> fatal error LNK1104: cannot open file 'libc.lib' in project "hs071_cpp". I
> tried to fix this problem by setting "properties->Linker->input->Ignore
> Specific Library" as /NODEFAULTLIB:libc.lib. But it still doesn't work well.
> 
> 
> ------ Rebuild All started: Project: hs071_cpp, Configuration: Release Win32 ------
> Deleting intermediate and output files for project 'hs071_cpp', configuration 'Release|Win32'
> Compiling...
> hs071_nlp.cpp
> hs071_main.cpp
> Generating Code...
> Linking...
> vcf2c.lib(open.obj) : error LNK2019: unresolved external symbol _errno referenced in function _f_open
> vcf2c.lib(wrtfmt.obj) : error LNK2001: unresolved external symbol _errno
> vcf2c.lib(endfile.obj) : error LNK2001: unresolved external symbol _errno
> vcf2c.lib(sfe.obj) : error LNK2001: unresolved external symbol _errno
> vcf2c.lib(fmt.obj) : error LNK2001: unresolved external symbol _errno
> vcf2c.lib(wsfe.obj) : error LNK2001: unresolved external symbol _errno
> vcf2c.lib(err.obj) : error LNK2001: unresolved external symbol _errno
> Release/hs071_cpp.exe : fatal error LNK1120: 1 unresolved externals
> Build log was saved at "file://c:\Dokumenty\projekt\ipopt\Ipopt-3.5.4\Ipopt\MSVisualStudio\v8\hs071_cpp\Release\BuildLog.htm"
> hs071_cpp - 8 error(s), 0 warning(s)
> ========== Rebuild All: 4 succeeded, 1 failed, 0 skipped ==========
> 
> I try both release, debug mode, I try to modify makefile.vc to 
> 
> CFLAGS = -DUSE_CLOCK -DMSDOS -DNO_ONEXIT -MTd -DNO_My_ctype -DNO_ISATTY

Just a guess:
In your "release" build of ipopt, did you use the same kind of -M flag
as in the build of the f2c library?
That is, if you have -MT in the CFLAGS of the f2c library build, you
need to make sure that also a multithreaded build (-MT) is chosen for
the Ipopt build in Visual Studio.

> 1. in Project / Settings
> 
>     - In Object/Library modules, you added smi.lib
> 
>     - ensure "Ignore all default libraries" is *un*checked.
> 
>     - in Project Options add manually  /nodefaultlib:"libc" 
> 
>     - add a new .c file in your project (any name)
> 
>     - in this .c file, put a single line:
> 
> int errno= 0;
> 
> 
> 2. Do Build => Rebuild all
> 
> 3. You may have a problem with precompiled headers
> => In Project / Settings / C/C++, Category "Precompiled headers"
> click the radio button "Not using precompiled headers"
> And Rebuild all again.
> 
> Nothing works, pls help

What was the problem when trying this kind of cheating?
When I did something like this in a C++ code, I had to put an extern "C"
around:
extern "C" {
 int errno = 0;
}

Best,
Stefan


More information about the Ipopt mailing list