Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding Object to Library

Status
Not open for further replies.

Malachi

Programmer
Aug 13, 2001
38
US
I am compiling a c source file to create an object, which I would like to then link into an existing static library (.lib). How can I use the Project Properties dialog to define this type of link? I want to produce a new .lib file.

So far, I have a project defined with only the c source file. I can build the object. However, I don't know how to direct the MSVC++ to link the object to an existing library.

Thanks.
 
If you want to use your LIB in MSVC++ go to project->settings and there you can enter a path to your LIB file.
 
I'm making a Win32 static library project. I'm creating a "library", so the project->settings does not give me an opportunity to enter a path to the LIB file. It does however allow me to define the output filename. The name of the output library is the same as the one I'm using to link against the object file. I'm adding an object to a library that already exists in a Win32 static library project. Does that help you answer the problem better?
 
I have a makefile that does this already.
lib /out:some.lib some.lib c.obj
 
Hello Malachi. Have you found the answer to your original question? I have noticed that when our programmers need to link lib to lib, instead of linking by lib file name, they have added lib source directory to Project settings -> C/C++ tab -> Project options. I didn't really like this method since this method doesn't clearly tell dependencies. I have looked for the most standard way to link lib to lib. Does anyone know what would be the best way to link lib to lib?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top