OpenCV 2.4 - fatal error LNK1104

This is my first GUI attempt with Visual Studio Professional 2010, and yes, it includes OpenCV. Please see the following code

The GUI code is very simple, which contains only 1 button.

Form1.h

#pragma once #include "ImageOpen.h" namespace GUI { using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; /// <summary> /// Summary for Form1 /// </summary> public ref class Form1 : public System::Windows::Forms::Form { public: Form1(void) { InitializeComponent(); // //TODO: Add the constructor code here // } protected: /// <summary> /// Clean up any resources being used. /// </summary> ~Form1() { if (components) { delete components; } } private: System::Windows::Forms::Button^ button1; protected: private: /// <summary> /// Required designer variable. /// </summary> System::ComponentModel::Container ^components; #pragma region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> void InitializeComponent(void) { this->button1 = (gcnew System::Windows::Forms::Button()); this->SuspendLayout(); // // button1 // this->button1->Location = System::Drawing::Point(27, 49); this->button1->Name = L"button1"; this->button1->Size = System::Drawing::Size(75, 23); this->button1->TabIndex = 0; this->button1->Text = L"button1"; this->button1->UseVisualStyleBackColor = true; this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click); // // Form1 // this->AutoScaleDimensions = System::Drawing::SizeF(6, 13); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; this->ClientSize = System::Drawing::Size(284, 262); this->Controls->Add(this->button1); this->Name = L"Form1"; this->Text = L"Form1"; this->ResumeLayout(false); } #pragma endregion private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { ImageOpen i; i.OpenImage(); } }; } 

Form1.cpp

//GUI.cpp: main project file.

 #include "stdafx.h" #include "Form1.h" using namespace GUI; [STAThreadAttribute] int main(array<System::String ^> ^args) { // Enabling Windows XP visual effects before any controls are created Application::EnableVisualStyles(); Application::SetCompatibleTextRenderingDefault(false); // Create the main window and run it Application::Run(gcnew Form1()); return 0; } 

ImageOpen.h

 #pragma once #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <iostream> using namespace std; using namespace cv; class ImageOpen { public: ImageOpen(void); void OpenImage(); }; 

ImageOpen.cpp

 #include "StdAfx.h" #include "ImageOpen.h" ImageOpen::ImageOpen(void) { } void ImageOpen::OpenImage() { Mat image = imread("C:/Users/Public/Pictures/Sample Pictures/Tulips.jpg"); namedWindow("Image"); imshow("Image",image); waitKey(0); } 

The GUI is simple as shown below, so I don’t think you will even have to look at the GUI code

enter image description here

Unfortunately, when I run this, I get the following error

 1>------ Build started: Project: GUI, Configuration: Debug Win32 ------ 1> stdafx.cpp 1> AssemblyInfo.cpp 1> GUI.cpp 1> ImageOpen.cpp 1> Generating Code... 1>LINK : fatal error LNK1104: cannot open file 'tbb_debug.lib' ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== 

This also happened in VS 2010 Express. Why am I getting this error? I can not find the tbb_debug.lib file in opencv. My version of opencv is 2.4. Please, help!

UPDATE

This link is OpenCV and VS2010: Fatal error LNK1104: atal error LNK1104: cannot open the tbb_debug.lib file , it means that we need to change the general runtime of the language; there is no support for the runtime of a common language.

Then i get this error

 1>------ Build started: Project: GUI, Configuration: Debug Win32 ------ 1> stdafx.cpp 1> ImageOpen.cpp 1> GUI.cpp 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\form1.h(6): error C2871: 'System' : a namespace with this name does not exist 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\form1.h(7): error C2653: 'System' : is not a class or namespace name 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\form1.h(7): error C2871: 'ComponentModel' : a namespace with this name does not exist 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\form1.h(8): error C2653: 'System' : is not a class or namespace name 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\form1.h(8): error C2871: 'Collections' : a namespace with this name does not exist 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\form1.h(9): error C2653: 'System' : is not a class or namespace name 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\form1.h(9): error C2871: 'Forms' : a namespace with this name does not exist 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\form1.h(10): error C2653: 'System' : is not a class or namespace name 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\form1.h(10): error C2871: 'Data' : a namespace with this name does not exist 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\form1.h(11): error C2653: 'System' : is not a class or namespace name 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\form1.h(11): error C2871: 'Drawing' : a namespace with this name does not exist 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\form1.h(16): error C2059: syntax error : 'public' 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\form1.h(16): error C2059: syntax error : 'public' 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\form1.h(16): error C2653: 'System' : is not a class or namespace name 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\form1.h(17): error C2143: syntax error : missing ';' before '{' 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\form1.h(17): error C2447: '{' : missing function header (old-style formal list?) 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\gui.cpp(8): error C2337: 'STAThreadAttribute' : attribute not found 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\gui.cpp(9): error C2065: 'array' : undeclared identifier 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\gui.cpp(9): error C2653: 'System' : is not a class or namespace name 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\gui.cpp(9): error C2275: 'cv::String' : illegal use of this type as an expression 1> c:\opencv\build\include\opencv2\core\core.hpp(87) : see declaration of 'cv::String' 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\gui.cpp(9): error C2059: syntax error : '>' 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\gui.cpp(10): error C2143: syntax error : missing ';' before '{' 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\gui.cpp(10): error C2447: '{' : missing function header (old-style formal list?) 1> AssemblyInfo.cpp 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\assemblyinfo.cpp(3): error C2871: 'System' : a namespace with this name does not exist 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\assemblyinfo.cpp(4): error C2653: 'System' : is not a class or namespace name 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\assemblyinfo.cpp(4): error C2871: 'Reflection' : a namespace with this name does not exist 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\assemblyinfo.cpp(5): error C2653: 'System' : is not a class or namespace name 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\assemblyinfo.cpp(5): error C2871: 'CompilerServices' : a namespace with this name does not exist 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\assemblyinfo.cpp(6): error C2653: 'System' : is not a class or namespace name 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\assemblyinfo.cpp(6): error C2871: 'InteropServices' : a namespace with this name does not exist 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\assemblyinfo.cpp(7): error C2653: 'System' : is not a class or namespace name 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\assemblyinfo.cpp(7): error C2871: 'Permissions' : a namespace with this name does not exist 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\assemblyinfo.cpp(14): error C2337: 'AssemblyTitleAttribute' : attribute not found 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\assemblyinfo.cpp(15): error C2337: 'AssemblyDescriptionAttribute' : attribute not found 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\assemblyinfo.cpp(16): error C2337: 'AssemblyConfigurationAttribute' : attribute not found 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\assemblyinfo.cpp(17): error C2337: 'AssemblyCompanyAttribute' : attribute not found 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\assemblyinfo.cpp(18): error C2337: 'AssemblyProductAttribute' : attribute not found 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\assemblyinfo.cpp(19): error C2337: 'AssemblyCopyrightAttribute' : attribute not found 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\assemblyinfo.cpp(20): error C2337: 'AssemblyTrademarkAttribute' : attribute not found 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\assemblyinfo.cpp(21): error C2337: 'AssemblyCultureAttribute' : attribute not found 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\assemblyinfo.cpp(34): error C2337: 'AssemblyVersionAttribute' : attribute not found 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\assemblyinfo.cpp(36): error C2337: 'ComVisible' : attribute not found 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\assemblyinfo.cpp(38): error C2337: 'CLSCompliantAttribute' : attribute not found 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\assemblyinfo.cpp(40): error C2337: 'SecurityPermission' : attribute not found 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\assemblyinfo.cpp(40): error C2653: 'SecurityAction' : is not a class or namespace name 1>c:\users\yohan\documents\visual studio 2010\projects\gui\gui\assemblyinfo.cpp(40): error C2065: 'RequestMinimum' : undeclared identifier 1> missing quotes ("") around 'RequestMinimum'? 1> Generating Code... ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== 
0
source share
1 answer

As suggested in the link: OpenCV and VS2010: Fatal error LNK1104: atal error LNK1104: cannot open the file 'tbb_debug.lib

You can change the general runtime support (/ clr) to support support for common languages ​​in the configuration properties β†’ General β†’ Common language runtime.

You also did not include the related window title window files in Form1.h

0
source

Source: https://habr.com/ru/post/1436458/


All Articles