I am currently facing a linking error on Visual Studios C++ 2010. I know exactly that I forgot to link some .lib files against the project and it turned out to be true.
However, the problem is my project depends on another project (that I did not do) that provides header files and .lib files that have different names. And I am having a hard finding the specific lib files.
In this case, how can I find the right .lib file for the symbols I am using?
Does this help? (dumpbin /SYMBOLS) https://stackoverflow.com/questions/1935183/tool-to-view-functions-exported-in-static-library
Related
I did the following experiment: I created a statically linked C++ library solution MyLibrary (I took the code from the MSDN example: https://msdn.microsoft.com/en-us/library/ms235627.aspx.) and built it. Then I created another C++ solution MyConsoleApp, using the console application template in Visual Studio (2017). I copied the MyLibrary.lib file to the root of MyConsoleApp project and added MyLibrary.lib to Linker -> Input -> Additional Dependencies (also had to copy over the headers too of course). What I didn't do was to copy over the MyLibrary.pdb file.
I would've expected to get a linker warning about the missing .pdb file but this was not the case. Then I moved only MyConsoleApp to another machine and tried to build it again, this time getting a missing .pdb linker warning. It seems that Visual Studio is storing the .pdb files when building a solution somewhere on the machine and is able to use those .pdb files when linking other solutions on the same machine.
I would like to be able to disable this behaviour or to be able to remove the cached .pdbs so that I could be sure that when sharing work with other developers they won't get warnings that I'm not getting on my own machine.
Visual Studio doesn't cache the .pdb file. What happens here is that the absolute path to the original .pdb file is stored in the build outputs (.exe, .dll or .obj files) and Visual Studio is able to took it up based on that.
Check this answer for a way to prevent that: Remove PDB references from released file.
I have a VST plug-in which I have built on Windows using Visual Studio. It depends on two libraries (FFTW and Speex). I am able to link these to the project and it compiles - so far so good.
However, the problem is that I cannot get the plug-in to compile without requiring the .dll files at runtime - I have looked elsewhere on this site, found suggestions, and tried the following in Visual Studio:
Ensuring Configuration->Linker->Input->Additional Dependencies contain the .lib files I am looking to link
Ensuring Configuration->Linker->Additional Library Directories contain the directories of my .lib files
Making sure Configuration->C/C++->Code Generation->Runtime Library is set to MultiThreaded /MT
Yet, when I check using Dependency Walker (http://www.dependencywalker.com/), my plug-in still requires the .dll files.
The host with which I am looking to use the plug-in cannot load the VST if it has .dll dependencies (I have tried another host and it works fine, as long as the .dll files are in the same directory as the plug-in .dll file).
I would really like this plug-in to link statically to these libraries, can anyone help?
Thanks!
Adam
p.s. - as a check, I made a simple plug-in with no dependencies and compiled it and this loads in the host no problem
We have a project which has a multistage build system: it's split into modules consisting of multiple source files, and each module is compiled and partially linked into a single object file. Then these object files are linked together into the final program. (This approach is required for non-technical reasons.)
Currently we use gcc and binutils for this, and it's very easy there: ld -r will partially link multiple object files into one.
Unfortunately, we've now been faced with a platform for which there is no gcc/binutils support, only Visual C support. So I've been reworking the build system to use the native Microsoft tools. Unfortunately I have not yet found a way to do a partial link --- link.exe seems to only support outputting EXE or DLL files.
Does anyone know of a way to do a partial link in Visual Studio?
Note that .LIB libraries are not adequate. Neither is incremental linking. And this is all happening from the command line.
I have a VS 2008 C++ project which uses a third-party library (Open Scene Graph).
When i start debugging the project, each time a function from this external library is called, the debugger just jumps over it, because (obviously) the debugger has no .cpp files where to look up the code. It only jumps into header files which are linked to my project because those files exist and their location is known. So, i can only see what's going on in those small inline functions, but not in the bigger functions whose implementation is in .cpp files which i don't have.
I need is to somehow step thru the source code of these third-party dlls/libs the same way I do with my own code.
I downloaded the the whole source code of that library and compiled it on my machine. Now i have the dlls and libs, and the .pdb files, and the .cpp files, too. But how exactly do I tell Visual Studio the locations of the .cpp files of the third-party library, so that it knows, that when i want to step into a function coming from a .dll or a .lib it opens the corresponding .cpp file (even though it's not in my project and is located is a completely different folder)?
Is this at all possible?
I tried copying the .libs, the .dlls (debug versions), .pdbs both to the locations which my Project uses and "Additional Library Directories" and to the project's folder but this must be not enough.
Add the dir with the PDB files to Tools -> Options -> Debugging -> Symbols.
My project has a lot of static library (with sources).
Some base libraries can't be breakpointed because the source code is different from the original version.
I know I can workaround if I turn off "Require source files to exactly match the original version" option, but that warning makes me worry.
Is it Microsoft Visual Studio 2008 bug?
I heard it happen when checksum of source code is different with obj.
I have all sources of library and linked as static library,
I cleaned and rebuilt all, but warning never disappeared.
What a worse is, when I turn off "Require source files to exactly match the original version" option, watch windows can't show what member variable has with this error "FIX: CXX0033 Error in OMF Type from Forward Class Declaration"
http://support.microsoft.com/kb/131147/en-us?fr=1
I searched stack overflow and find several similar article (http://stackoverflow.com/questions/163133/breakpoint-not-hooked-up-when-debugging-in-vs-net-2005) but those couldn't help me.
Environment :
Windows 2003 server x64
Visual Studio 2008 sp1 Version 9.0.30729.1 SP
Thanks in advance.
Double check your symbols and sources search paths to ensure they include the right folders with the static library. Check that y7ou are linking the .lib and the .obj files from the right directory. Also, break in program under the debugger, and check where are the symbols for the library loaded from - they should be from the same folder the .obj and the .lib came from.