Determine Why Lib File is Being Linked [duplicate] - visual-studio

This question already has answers here:
Linker Trouble: How to determine where a "/DEFAULTLIB" is coming from
(3 answers)
Closed 1 year ago.
I'm in the process of updating an older Hololens project to the latest version of Visual Studio, the latest Target Platform, and a newer version of C++. We haven't done a build of this project in over a year, so we've also had many changes to our codebase (which is shared with our desktop version, so we are able to use a lot more libs than we can in Hololens).
I'm currently getting this error when compiling:
LINK: fatal error LNK1104: cannot open file 'comsuppwd.lib'
Being a Hololens app, the comsuppw library isn't available. Is there a way to see what is causing this library to be included? I'm trying to avoid having to manually go through a years worth of changelists to find what is causing this library to be linked.
I've used dumpbin/undname to get a list of all of the public symbols in comsuppw.lib, and done a search for any we may have used (and found nothing). I've also turned on verbose linking, but didn't see anything helpful.

I was able to track down the offending class by using dumpbin on all of the .obj files, using this command:
for /R %1 in (*.obj) do #dumpbin /directives /section:.drectve "%1" > "%1".directives.txt
Found here

Related

Linker error building Adobe DNG SDK on MacOS 11

I am working on a project that uses Adobe's DNG SDK 1.6 library, and it is supposed to work on Windows and MacOS.
The library has instructions on how to build it for both platforms, but I had to figure out an error that came up on Windows with Visual Studio. I am not very experienced with big C++ projects so it was not trivial but I got it working. Most of my own code will be done in C# .Net Core, calling the native libraries using a wrapper class with P/Invoke.
Now for Mac that's a different story, I have a MacOS 11 VM, installed Xcode 12.5.1 and followed the steps provided, as expected, it does not work. Bare in mind this is my first time touching Xcode and MacOS.
The project I am trying to build is dng_validate, and it depends on two libraries built by these projects: XMPFiles64 and XMPCore64.
The library projects build without any hiccups, each one of them creating a ".a" file in the folder: dng_sdk_1_6/xmp/toolkit/public/libraries/macintosh/intel_64_libcpp/Debug, they are named libXMPFilesStaticDebug.a and libXMPCoreStaticDebug.a respectively.
When I try to build the dng_validate project, I get the following error:
Library not found for -lXMPFilesStaticDebug
Because of the the error starting with an "l" instead of "lib", under both libraries project settings, I changed the "Executable Prefix" setting to "l" instead of "lib". Rebuilt both of them and made sure the file names changed as expected. But the error persists when trying to build the main project.
Under dng_validate's project settings, there is a setting called "Library Search Paths" and it does point to the proper aforementioned folder using a relative path. I even changed it to an absolute path to see if that would make it work.
I am really lost here, does anyone have an idea of what might be causing it?
Well... After asking on other forums and almost hiring a freelancer to fix this for me, I tried another shot in the dark of renaming the library files and it worked.
I changed the extensions of libXMPFilesStaticDebug.a and libXMPCoreStaticDebug.a from ".a" to ".dylib" and it just compiled and blew my mind with it.

How do I automatically find all dynamic libraries my Rust program uses (and put them into one directory)? [duplicate]

This question already has answers here:
How do I find out which dlls an executable will load?
(10 answers)
Closed 4 years ago.
I am building a Rust application that uses the iui crate.
When I click the executable after doing cargo build, I get an error saying that the DLL isn't in the path. I did put the DLL in the path to see if it worked and it did but it opened a command window with the GUI which it doesn't do that when I run cargo run.
I don't know a lot about how Rust builds executables and I don't know where Rust keeps the dependencies so I would like to know how I can get all my dependencies in a single path. Having something that can grab all the dependencies for me would be nice because the dependency has other dependencies that I probably need to add and I really don't know what they are.
I plan on making an installer for my Rust application and I will need all of the dependencies for it to work.
It's not specific to Rust. For Windows, you'll find the tools in this answer: How do I find out which dlls an executable will load?

XCode Project - ld: library not found for -llib

Recently I ran into a CMake problem that can be found in this thread:
Cmake on OSX Yosemite 10.10.3 - GLEW: package 'gl' not found
Eventually it got solved, maybe partly due to my inexperience in XCode and CMake. (I mainly used visual studio to compile projects in the past.)
After the alteration in the linked thread I got warning about my GLEW libs in CMake
(Is this something I should be worried about or is it not important?):
MACOSX_RPATH is not specified for the following targets:
GLEW_MX_shared
GLEW_shared
I simply ignored it and tried to compile my project in XCode with the ALL_BUILD target selected. In the sparky target it said the include files in main could not be found so I added the .h files into the inc folder of my project.
When I compiled again the compiler started complaining again
(I don't know what this error means and how I can fix it.):
ld: library not found for -llib
Googled it for the entire day now and I can't find anything to solve this issue.
It's so frustrating working with XCode as an IDE but I really want to learn more about different platforms and their most popular IDE's so I can make multi platform applications from the start instead of porting it afterwards.
And if it matters I am using OSX Yosemite 10.10.3.
To make my issue easier to understand, I've put a zip of my project on my dropbox.
https://www.dropbox.com/s/xnrh90kuih9ia5a/SPARKY%202.zip?dl=0
Feel free to ask questions if I explained things to briefly and again, thanks to everyone who contributes here. I really learned allot after discovering these forums.
EDIT: Alright I booted up my windows machine, generated a visual studio environment and tried to build it on there. Seems that the same problem also happens here. I looked at the linker attributes/flags and saw a lib.lib file added to the linking process which doesn't look right at all.
When removing the file, the error disappeared and many others arrived! (Which are simply solved by linking the appropriate libs so I wont handle those here.)
I misunderstood the error on my mac and thought it was referring to a random library which I needed to hunt down but actually it's a inconsistency in one of my CMake files.
EDIT2: Now I only have to find out where the lib.lib comes from and how I can ditch the flags from the project so I can generate my environment and build right away!
So moral of the story. Sometimes the solution is right in front of you and still ends up more like looking for a needle in a haystack.
I removed the following from my root CMakeLists.txt file and the random lib.lib library was gone from my generated projects
SET( PROJ_LIBRARIES "lib" )
I thought this added a folder containing libraries but actually what it did was adding another flag for a specific library because this variable was being fed to:
TARGET_LINK_LIBRARIES( ${PROJ_NAME} ${PROJ_LIBRARIES} ${OPENGL_LIBRARIES} ${GLEW_LIBRARIES} )

I have installed WxWidgets, but PgAdmin cannot see it

There was a similar question (here or on some related SE site), but I didn't find so I ask a new question (if you find it, send a link and vote to close this question if they are too similar).
I have finished installing WxWidgets (configure; make; make install), but while installing PgAdmin III 1.16 the make console doesn't recognize WxWidgets as installed. I found that absence of Unicode might be a problem in this case, but I have enabled the Unicode. What else should I do?
I have 32bit Windows XP and WxWidgets 2.9.4. Including PostgreSQL 9.1.3 went OK.
EDIT: I tried another way - through Visual Studio and Visual C++. I don't know if my problem is the same or just similar, but Visual Studio reports this error:
error C1083: Cannot open include file: 'wx/wxprec.h': No such file or directory
followed by 100 of other errors which seem to be conclusion of this one (mostly undefined types/functions with names beginning with "wx"). I added semicolons to the header (as was suggested here - fourth entry after "all replies"), but it didn't help. I also tried to add "include" and "lib" directories in WxWidgets to include path for every project, but no joy here.
Do anybody know how to solve it?
You need to point pgAdmin to wxWidgets installation under Windows. Its build instruction should explain how to do it but you must set up the include path (-I compiler option) and the libraries path (-L linker option) for it to compile and link properly.
Notice that for the include paths you must put the directory containing the wx/setup.h file generated during the build by configure first and the directory with all the rest of wx headers later.
Also, it probably goes without saying, but you must use the same compiler to build both wxWidgets and pgAdmin, so if you built wx using configure+make you can't use MSVC for pgAdmin.

fatal error LNK1104: cannot open file 'd3dc9.lib'

I'm currently going though a game programming book and am trying to compile some directx9 code
I have the latests DirectX11 SDK and the code has these lines of code
#pragma comment(lib,"d3d9.lib")
#pragma comment(lib,"d3dx9.lib")
But I get
LINK : fatal error LNK1104: cannot open file 'd3dc9.lib'
I don't know how to set it up to find this file although in fact I don't get why it asks for it since it isn't inside the Lib file for the DirectX 11 SDK and isn't what i've asked for.
The linker only knows the name of the .lib file, it doesn't know what directory it is stored in. Project + Properties, Linker, General, Additional Library Directories setting.
The version 11 SDK is quite new. You may need an older version of the SDK if these .libs are no longer distributed. I know the June 2010 edition has them. Download is here.

Resources