Click here to Skip to main content
15,887,776 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi All,

I am using win7 build environment and have organized code using dirs and sources file. I use windows build command to build source files. During my development i am facing a issue. Let me describe the scenario.

ProjectA.dll, ProjectA.lib - This is a third party DLL with its .lib and header. We are including this ProjectA.dll to build a new static library ProjectB.lib. Till here compilation is working fine.

Now my requirement is to use static library ProjectB.lib in a third project ProjectC which will generate a DLL. So I have included ProjectB.lib in ProjectC' s sources file in TARGETLIBS section. But while building ProjectC, it is giving unresolved external symbol error for the functions which are in ProjectA.dll and used in ProjectB.lib. This linker error is showing in ProjectB.lib in build command output.

I am not able to figure out what is missing here.

Please help. Any suggestions would be highly appreciated.

Please let me know i am not able to properly explain the scenario.

Regards

Rahul

What I have tried:

All i have described in problem description
Posted
Updated 23-Jul-17 20:11pm
v2
Comments
Richard MacCutchan 24-Jul-17 3:22am    
You need to include ProjectA.lib in the build for ProjectC.

1 solution

You must include your third party files completly in the ProjectC, because it isnt linked staticly in the ProjectB.
 
Share this answer
 
Comments
Rahul@puna 24-Jul-17 3:13am    
Hi, Thanks for your response. Actually I have included header file and also provided lib reference as mentioned in post in TARGETLIBS section of sources file, but still getting issue. Let me explain with an example:
Suppose i have function in ProjectA.dll as projectAfun();
Now this function is used in ProjectB.lib. When I build ProjectB, this is compiling properly. Now When I use static lib ProjectB.lib in my ProjectC and also include header file of ProjectA and give refernce of ProjectA.lib in ProjectC, I am still getting following error -
ProjectB.lib(ProjectB.obj) : error LNK2001: unresolved external symbol projectAfun

Regards

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900