creating a static library using third party libs


I have a Visual studio .sln file that has a couple of projects in it , let's call it project A,B,C. One particular project is designed such that its configuration type is a static lib. (That means it creates a static lib called MyProject.lib) . This MyProject.lib is then used by another project, one of which is the application.

I am running into a problem where I want to use some third party static lib (that sources a dynamic lib) in the project,MyProject . But since its type was a static lib, I did not have a Linker option. As a result i created another project , let's call it D, of type application, where I put files that required the third party . D builds without errors. I included the header file location in the main project A that was of type application. However, now when compiling A, I get linker errors , saying external symbol reference not found (these are the third party references) in D  functions.

anyone can show me a good way to add third party libs to a project that produces a static lib?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

If you are building a library, the project has to be a library.
So you have mysatatic.lib you then have a 3rdpaty.lib but it includes references to dynamic pubs.
Your setup/project has to include the dynamic libs in the package

Do you have the source of the 3rd party lib or you only have an API reference?
when compiling A, I get linker errors , saying external symbol reference not found
you must resolve the issues in the project where you get these errors.

you have to add the static library of the third-party in the Linker - Input - Additional Dependencies what would resolve the undefined symbols when linking.

if the third-party has two static libraries, one for debug and one for release you would use the right one for your debug and release configuration. the path to the library must be added to vc directories - library directories.

note, static libraries a third-party delivered additionally to a dll, are only wrapper functions which call into the dll. it is not the same as you were doing, when you put shared function code into a static library. however, from linker's point of view it is the same: a bunch of modules which can be added once to an executable at link time (and which itself may demand for other external references).


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual C++.NET

From novice to tech pro — start learning today.