How to exclude .lib file from linker command line argument in VC++ - visual-studio-2010

I am compiling a vc++ program which is showing below error
error LNK1104: cannot open file 'D:\Visual Studio 2010\Projects\credentialproviders\Win32\Debug\Helpers.lib'
how i can remove that Helpers.lib file reference from linker command line argument because in project settings->linker->commandline its in readonly mode and I can't edit this to remove that line. I am using Visual Studio 2010.
thanks

Search the .vcproj file, and the project source code for "Helpers.lib". There are a couple places it can get linked in, and this is the simplest way to find it.
Otherwise, look for:
Project properties -> linker -> inputs
In the solution explorer, see if the .lib is included anywhere in the project tree.
Anywhere in the source code, #pragma comment(lib, "helpers.lib")
If Helpers is a project in your solution, check project dependencies for the project. By default, thisk linking is done implicitly if the project depends on it.

if this lib is not referenced in Linker->Input->Additional Dependencies, so check Project Dependencies, and remove any dependency on porject Helpers. also it's possible that this linking is done from code by #pragma comment(lib, "Helpers)

I don't really think the above answers it properly. I just had this same problem and the way to fix it is to go to View->Property Manager. double click Microsoft.Cpp.Win32.user and go to Linker->Input. There you can edit out the additional dependencies that were previously read only. Do it for both debug/release versions if needed.

Related

Linking External C++ Library (Exerces) in Visual Studio

I am working on a C++ project with
#include <xercesc/sax2/ContentHandler.hpp>
#include <xercesc/sax2/Attributes.hpp>
#include <xercesc/util/XMLString.hpp>
On the offical xercesc website, they have the following instructions:
I downloaded the distribution file
Opened the xerces-all.sln file in VS2017 and pressed build
Then I opened my project in VS2017, went to properties->Linker->Input->Additional Dependencies and added xerces-c.lib
However the VS2017 complier still can not find the included xerces files
The included documention you are looking at is titled "Building on Windows" so if for beuiding the library, not on using it afterwards.
You need to add the path to the include files in your project in C/C++ -> General ->Additional include directories
And for the library, you may need to add to the Additional Library Directories

Including the Expat library in Visual Studio 2013

I've downloaded a copy of Expat 2.0.1, which is basically a bunch of .h and .c files (see the complete directory in the screenshot below).
To add the library to the VS 2013 project I'm working on, I went to Properties -> Configuration Properties -> VC++ Directories and added the path of the 2.0.1 folder shown in the screenshot to the "Include Directories" field. This gets rid of all the intellisense errors, but when I build the project I get a bunch of linker errors that are complaining about unresolved symbols (eg XML_ParserCreate, which is a function from the Expat library). I can right-click on these symbols and peek the definition, so it seems like everything is "hooked up" correctly. How can I get the linker to stop complaining? There doesn't seem to be any libraries I can add to the Linker section of the configuration. Do I need to use Makefile.MPW somehow?
This is just the source, you have to create the library yourself, see MicrosoftDocs. BTW MPW is a Mac file.

OpenCV error in Visual Studio 2010: fatal error LNK1104: cannot open file 'opencv_calib3d243.obj'

I have installed OpenCV 2.4.3 on Windows 7-64 bit. I am using Visual Studio 2010. OpenCV is installed in c:/opencv. I have added the environmental variables and all the necessary library dependecies. But, I always get this error :
fatal error LNK1104: cannot open file 'opencv_calib3d243.obj'.
The settings for VS2010 linker options is like below:
Additional Library Directories: C:\opencv\build\x64\vc10\lib
Additional Dependencies: I have listed all the libraries available in
the directory mentioned above.
But when I run I get that error. This library actually exists in the mentioned directory, but I don't know why I get this error. I have seen some other people ask similar questions, but none of the solutions could solve my problem.
use dependency walker tool to make sure u have all necessary dlls & libs loaded...
'opencv_calib3d243.obj' != 'opencv_calib3d243.lib' !
it should be 'lib', but you probably typed 'obj' there (which does not exist), look at it again.
Go to Project properties ->Configuration Properties -> Linker -> Input -> Additional Dependencies
In additional dependencies add
opencv_core243.lib
opencv_imgproc243.lib
opencv_highgui243.lib
opencv_ml243.lib
opencv_video243.lib
opencv_features2d243.lib
opencv_calib3d243.lib
opencv_objdetect243.lib
opencv_contrib243.lib
opencv_legacy243.lib
opencv_flann243.lib
If you have already added , make sure you have added opencv_calib3d243.lib
had the same problem, except VS was complaining about opencv_.obj instead, (I'm running it under visual studio 2010 express)
Fixed it by copying and pasting the lib dependencies from the provided "opencv_example" example (Project properties->linker->Input:Additional Dependencies).
So for convenience, I have this value in my Additional Dependencies:
opencv_core246d.lib;opencv_imgproc246d.lib;opencv_highgui246d.lib;opencv_ml246d.lib;opencv_video246d.lib;opencv_features2d246d.lib;opencv_calib3d246d.lib;opencv_objdetect246d.lib;opencv_contrib246d.lib;opencv_legacy246d.lib;opencv_flann246d.lib;%(AdditionalDependencies)
Note I: I'm running version 246, so you may have to adjust these names to reflect your installed version which appears to be 243
Note II: I'm compiling for debug, haven't tried release, but you should remove the trailing 'd' from the lib name for correctness.

linking libcurl in Visual Studio 8

I have a C project needed to be compiled into a DLL.
This C project includes . I had compiled a libcurl.dll from source with VS2008.
I put the libcurl.dll in C:\Windows\System32 (I suppose this serves as installing the DLL)
Now, when I compile my own C project, it says 'cannot open include file curl/curl.h'.
Did I miss any steps? Sorry I'm really new to Windows system.
Thanks in advance!
You need to add the path to curl/curl.h as an additional include directory in your project settings. Right click on the project, go to properties, and it's under the compiler section.
You'll also need to add curl.lib as a input library under your linker settings.

Cannot open include file "d3dx9.h"

Edit: Of course, immediately after working on it for an hour then posting here, I found the stupid mistake...
I'm getting compiler errors when trying to #include <d3dx9.h> in a project. I'm receiving "fatal error C1083: Cannot open include file: 'd3dx9.h': No such file or directory".
I do have the DirectX SDK installed (I also just tried reinstalling it to no avail).
In the Project Properties:
VC++ Directories are set to "$(DXSDK_DIR)Include;$(IncludePath)" and "$(DXSDK_DIR)Lib\x86;$(LibraryPath)" for Include and Library directories respectively for all configurations—and the environment variable %DXSDK_DIR% points to C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\ as expected.
C/C++ > General settings has $(DXSDK_DIR)include listed in the Additional Include Directories
Linker > Input > Additional Dependencies has d3dx9d.lib included for Debug and d3dx9.lib included for Release configuration.
I am able to successfully compile and run tutorial projects from the DirectX Sample Browser.
Visual Studio's Intellisense/autocomplete will find d3dx9.h and suggest type and function names that are within the file (and not included through anything else I'm #includeing) so it seems that Intellisense can find it.
Any suggestions on what I'm forgetting or what else to try?
Thanks
you forgot one thing:
Go to VC++ Directories -> Library Directories
add $(DXSDK_DIR)LIB\x86
apply.
Done. Hope this helps
You should make sure you have ALL paths sorounded by quotes (").
Instead of $(DXSDK_DIR)include you should have "$(DXSDK_DIR)include"
I didn't realize that one of the other projects in the solution was #includeing a file that was #includeing a file that was #includeing d3dx9.h and I hadn't added those paths to that project.
/facepalm
Find the file on your computer, and add it's folder to the properties of your project.
Assuming you have visual studio: Properties/C/C++/General/Additional Include Libraries.
I tried all of these suggestions and none worked.
Turns out the $(DXSDK_DIR) variable doesn't work if you install DirectX while Visual Studio is still running. The solution for me was to restart Visual Studio (+ adding the paths in the solutions listed above, of course).

Resources