Śledzę ten tutorial tutaj jak wspomniano dokładnieOpenCV Budowanie w przypadku błędu LINK Visual Studio
Teraz spróbuj uruchomić prosty kod OpenCV na Visual Studio, ale wciąż otrzymuję błędy linkera. Próbuję to OpenCV tutorial in particular
Oto błąd ciśgle:
1>Linking...
1>LINK : warning LNK4067: ambiguous entry point; selected 'mainCRTStartup'
1>OpenCV_Proj.obj : error LNK2019: unresolved external symbol "int __cdecl cv::waitKey(int)" ([email protected]@@[email protected]) referenced in function _main
1>OpenCV_Proj.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class cv::_InputArray const &)" ([email protected]@@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@Z) referenced in function _main
1>OpenCV_Proj.obj : error LNK2019: unresolved external symbol "public: __thiscall cv::_InputArray::_InputArray(class cv::Mat const &)" ([email protected]@@[email protected]@[email protected]@Z) referenced in function _main
1>OpenCV_Proj.obj : error LNK2019: unresolved external symbol "void __cdecl cv::namedWindow(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,int)" ([email protected]@@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]) referenced in function _main
1>OpenCV_Proj.obj : error LNK2019: unresolved external symbol "class cv::Mat __cdecl cv::imread(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,int)" ([email protected]@@[email protected]@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]) referenced in function _main
1>OpenCV_Proj.obj : error LNK2019: unresolved external symbol "void __cdecl cv::fastFree(void *)" ([email protected]@@YAXPAX[email protected]) referenced in function "public: __thiscall cv::Mat::~Mat(void)" ([email protected]@@[email protected])
1>OpenCV_Proj.obj : error LNK2019: unresolved external symbol "public: void __thiscall cv::Mat::copySize(class cv::Mat const &)" ([email protected]@[email protected]@[email protected]@Z) referenced in function "public: class cv::Mat & __thiscall cv::Mat::operator=(class cv::Mat const &)" ([email protected]@@[email protected]@@Z)
1>OpenCV_Proj.obj : error LNK2019: unresolved external symbol "public: void __thiscall cv::Mat::deallocate(void)" ([email protected]@[email protected]@QAEXXZ) referenced in function "public: void __thiscall cv::Mat::release(void)" ([email protected]@[email protected]@QAEXXZ)
1>C:\Users\Saher\Documents\Visual Studio 2008\Projects\OpenCV_Proj\Debug\OpenCV_Proj.exe : fatal error LNK1120: 8 unresolved externals``
Dla następującego kodu:
// OpenCV_Proj.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main(int argc, char** argv)
{
if(argc != 2)
{
cout <<" Usage: display_image ImageToLoadAndDisplay" << endl;
return -1;
}
Mat image;
image = imread(argv[1], CV_LOAD_IMAGE_COLOR); // Read the file
if(! image.data) // Check for invalid input
{
cout << "Could not open or find the image" << std::endl ;
return -1;
}
namedWindow("Display window", CV_WINDOW_AUTOSIZE);// Create a window for display.
imshow("Display window", image); // Show our image inside it.
waitKey(0); // Wait for a keystroke in the window
return 0;
}
int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}
I zostały starając się, aby OpenCV działało przez jakiś czas na VS2008 i jakakolwiek pomoc dotycząca problem zostanie rozwiązany.
UWAGA: W pliku readme samouczka Oto co ja następuje:
1) Add build\bin and one of build\{x86|x64}\{vc9\vc10\mingw}\bin to your system path (to use DLLs)
Add build\{x86|x64}\{vc9\vc10\mingw}\lib or
build\{x86|x64}\{vc9\vc10\mingw}\staticlib as library directories to your linker settings,
Add build\include and build\include\opencv as include directories to your compiler settings.
Any help with getting this to work is really appreciated.
Dziękuję. To rozwiązało problem z łącznikiem –
Cześć, mam pytanie ... Jeśli zbudujemy projekt VS2010 przy użyciu CMake, czy nie powinien on tworzyć wszystkich zależności ...? Wciąż dostaję ten sam błąd, – user1036908