3

I have found two similar questions this and this . But they both use opencv, and opencv indeed provide the corresponding lib. I don't use opencv, and my project is very simple, just hello world.I have changed project default configuration like this

enter image description here except for these configurations, others all take defaults

I just want to test my project configuration,that works find for win32 debug and release. But not work for x64 debug and release, they all tell me LINK : fatal error LNK1104: cannot open file 'opencv_world341d.lib' I indeed know my project does not use any opencv lib, but why they tell me I need to use opencv_world341d.lib my code

#include<iostream>
using namespace std;
int main()
{
    cout << "hello world" << endl;
}
acraig5075
  • 10,588
  • 3
  • 31
  • 50
  • 1
    Create a new project. Somehow you have an opencv dependency in your current project. – drescherjm Nov 12 '19 at 19:06
  • 1
    Check your project properties by going to `Project->Properties` and see that your `Linker->Input` tab doesnt have any dependencies for OpenCV. If you see `OpenCV.lib` in the `Additional Dependencies` field, remove it. Not sure if this will fix it but you can try. – alteredinstance Nov 12 '19 at 19:12
  • 1
    You could do a text search in the actual project files for opencv. They are text / xml. – drescherjm Nov 12 '19 at 19:16
  • " I don't use opencv" I don't follow. Why is this tagged opencv then? –  Nov 12 '19 at 19:29
  • ***Why is this tagged opencv then?*** Somehow the project currently has an opencv dependency and the person asking the question does not understand that. It could be that the example code is not representative of the project and some other third party library is used bringing in the dependency or perhaps the OP had an opencv dependency then wants to remove it. – drescherjm Nov 12 '19 at 19:41
  • The image shown is not that interesting. More interesting would be if opencv is in the linker -> Input -> Additional Dependencies. – drescherjm Nov 12 '19 at 19:45
  • Change the _Platform_ dropdown to x64, then check the _Linker>Input_ page. – acraig5075 Nov 12 '19 at 19:47
  • 2
    Is a project property sheet in use? Have you used opencv in the past? – drescherjm Nov 12 '19 at 19:49
  • @alteredinstance Thanks for your answer. At `Project->Properties->Linker->Input->Additional Dependencies` I find `opencv_world341d.lib` in inherited values and its readonly, so I refer [this](https://social.msdn.microsoft.com/Forums/vstudio/en-US/dc9f28f0-4f56-4da2-8413-2116c10b31a6/vs-2010-how-to-change-vc-directories-inherited-values-read-only?forum=vcgeneral) and reedite `Microsoft.cpp..users.props` , after that reboot visual studio 2019, my problem solved. I think the problem can be closed, but your reply is comment , I cannot close. – kelamoyujuzhen Nov 13 '19 at 02:27
  • Glad I could help. You can post your comment as an answer, mark it as accepted, and close the question. Nice work! – alteredinstance Nov 13 '19 at 14:17

1 Answers1

1

Thanks for everyone who comments on the question. I have solved the problem, although this problem not relevant to OpenCV to much, but I think the solution to the problem may be helpful to others. When I build project, visual studio 2019 tell me cannot link opencv_world341d.lib, so I go to Project->Properties->Linker->Input->Additional Dependencies , and I found opencv_world341d.lib. So I need to remove it, but it's readonly. From this we know visual studio using settings file (Microsoft.cpp..users.props) to control global settings including Global search path. These files are located at $(USERPROFILE)\appdata\local\microsoft\msbuild\v4.0 directory. Then I reedit Microsoft.cpp.<Platform>.users.props, delete opencv_world341d.lib, reboot visual studio, problem solved.