www.digitalmars.com         C & C++   DMDScript  

c++.command-line - Warning 140: Library probably needs FIXLIB

reply Christof Meerwald <cmeerw web.de> writes:
What does it mean? ("Warning 140: Library probably needs FIXLIB")

// file 1
int a;


// file 2
extern int a;
static int *b = &a;

void f()
{ }


compile both files and create a static library (lib -c ...)

// main
extern void f();

int main()
{
  f();
}


compiled and trying to link with the library I get:

Warning 140: Library probably needs FIXLIB 
Error 42: Symbol Undefined ?a  3HA (int a)


Workaround: write "int a = 0;" instead of "int a;" in file 1.


bye, Christof

-- 
http://cmeerw.org                                 JID: cmeerw jabber.at
mailto cmeerw at web.de

...and what have you contributed to the Net?
Dec 31 2002
parent "Walter" <walter digitalmars.com> writes:
I don't know what is meant by fixlib. However, the declaration:
    int a;
generates a COMDAT which is not put into the symbol table in the library,
and is not used to satisfy unresolved externals unless something else in
that module is pulled in. This is not a bug, it is a deliberate way of doing
things. The runtime library depends on it, for example.

"Christof Meerwald" <cmeerw web.de> wrote in message
news:ausjsp$102c$2 digitaldaemon.com...
 What does it mean? ("Warning 140: Library probably needs FIXLIB")

 // file 1
 int a;


 // file 2
 extern int a;
 static int *b = &a;

 void f()
 { }


 compile both files and create a static library (lib -c ...)

 // main
 extern void f();

 int main()
 {
   f();
 }


 compiled and trying to link with the library I get:

 Warning 140: Library probably needs FIXLIB
 Error 42: Symbol Undefined ?a  3HA (int a)


 Workaround: write "int a = 0;" instead of "int a;" in file 1.


 bye, Christof

 --
 http://cmeerw.org                                 JID: cmeerw jabber.at
 mailto cmeerw at web.de

 ...and what have you contributed to the Net?

Dec 31 2002