I'm having difficulty of installation/ compilation of cvBlob into OpenCV Microsoft Visual Studio 2010 in WINDOW. I understood that there is a installation guide work on linux but I couldn't find how it can be done in Window.
I would appreciate if someone may provide me the installation guide in WINDOW as I found that cvBlob is very useful for my project.Thanks
For the moment there is no pre-built cvBlob for Visual Studio, so you are going to have to compile it yourself.
So before you start, make sure you have OpenCV installed in your computer.
Download CMake for Windows. CMake creates the Visual Studio project files that are needed to compile cvBlob.
Once you open cmake-gui, fill in the edit boxes "Where is the source code" and "Where to build the binaries" accordingly (adjust these to your settings):
C:/Documents and Settings/user/Meus documentos/Downloads/cvblob-0.10.3-src/cvblob
C:/Documents and Settings/user/Meus documentos/Downloads/cvblob-0.10.3-src/cvblob/build
Note: the build folder was created manually.
Click on button Configure to check for dependencies (CMake will try to find OpenCV on your computer) and then on Generate so it can generate the Visual Studio project files.
From here on it's the standard compilation procedures.
karlphillip's answer is correct, and you should follow it. Be advised, however, that if you're building the files using VS 2010, a few of them will fail and return this error:
LINK : fatal error LNK1104: cannot open file '..\lib\Debug\cvblob.lib'
To get around this, add the following to your cvblob.h file:
#define EXPORT __declspec (dllexport)
In the extern "C" block below that, add EXPORT before every function. For example:
EXPORT double cvContourPolygonArea(CvContourPolygon const *p);
After running into this error myself, I found the explanation here (which I adapted to make this post; all credit belongs to this link's author): https://code.google.com/p/cvblob/issues/detail?id=34
Just something you might want to watch out for. Hope it helps!
Related
I am writing code in C using GTK as GUI toolbox. I installed GTK3 via MSYS2 and managed to compile and build using GCC (TDM-Dragon) alright.
However, lately I am trying to compile and link using cl included in Visual Studio Community 2017 (heard it is faster and more stable). With this, I am having a hard time building an application. I am loosely following this tutorial:
http://www.tarnyko.net/en/?q=node/22
I created a BAT file and invoke it from the VS 2017 command prompt:
set GINC_PATH="C:\msys64\mingw64\include"
set GLIB_PATH="C:\msys64\mingw64\lib"
cl gtk3test.c -I"%GINC_PATH%\gtk-3.0" -I"%GINC_PATH%\glib-2.0" -I"%GLIB_PATH%\glib-2.0\include" -I"%GINC_PATH%\pango-1.0" -I"%GINC_PATH%\cairo" -I"%GINC_PATH%\gdk-pixbuf-2.0" -I"%GINC_PATH%\atk-1.0" -Dinline= /link /LIBPATH:%GLIB_PATH% gtk-3.lib gdk-3.lib gobject-2.0.lib glib-2.0.lib
This compiles alright, gives me gtk3test.obj. However, the linker returns the following error:
LINK : fatal error LNK1181: cannot open input file 'gtk-3.lib'
What am I doing wrong here? How would it be possible to use cl for linking GTK3 applications?
Thank you all in advance!
Xuttuh
Please check if you have gtk-3.lib in your folder path [%GINC_PATH%]. Even I have this issue using GTK+3.0, the package configuration is not giving the proper library reference.
The gtk library is something like gtk-win32-3.0.lib available inside lib folder %GINC_PATH%\lib in your case.
I still have issues in linking GTK libraries in my visual studio application even after providing the needed library references in Linker.
Hello I'm getting into Winsock programming in C. I believe that in order for me to access the (or any other header related to Winsock for that matter) header file I have to have Visual C++ 2010 installed and set it as my default compiler. So I download it, and in CodeBlocks I set it to my compiler. I run some Winsock code and I get this message:
C:\Users\Jared\Documents\Test.c|6|fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory|
I also get this message for including 'winsock.h' and 'windows.h'. This has something to do with the Visual C++ compiler. I try installing Visual C++ 2008 and use it as my compiler and get the same message. I then read that I have to install microsoft's SDK. I download and install it and it gets an error saying that I can't install it (this is the .Net framework 4.0 version). I then try the 3.5 version and it installs fine but my compiler still can't find the header files. I have the .net framework 4.0 so I don't see the problem. I also read that I have to include some header files in Visual C++ by going to Tools>Options>Projects and Solutions>VC++ Directories and I get the following message:
"VC++ Directory editing in tools > options has been deprecated."
Visual C++ 2010 no longer supports this feature. Does anyone have a solution or can help me with this?
Long story short: I cannot include 'winsock.h', 'winsock2.h', or 'windows.h' using the Visual C++ 2010 compiler.
All help is appreciated.
In Visual C++ 2010 it is recommended to use property sheets instead of this kind of global directory settings editing. You need to edit the user settings property sheet (probably Microsoft.Cpp.Win32.user.props) in your AppData folder. You can do it in the UI through the Property Manager via View->Property Manager and browsing for that sheet.
However, I think you should have $(WindowsSdkDir)include in Include Directories if you have it installed correctly.
I just started C recently and have been writing some basic C code, but is a bit clueless about how I should go about "installing" libraries like igraph in Visual Studio 2010. I downloaded the igraph "source code for Microsoft Visual Studio" here: http://igraph.sourceforge.net/download.html
(naive) Attempt
There is an "include" folder with all the ".h" files that I copied to the directory that my Visual Studio is set up to look in whenever I use include < something.h > but I get a "unresolved external symbol", which I know means the library isn't set up correctly.
Question
How should I go about "installing" igraph? (and possibly other C libraries)
Look in to the folders of your library, I suppose, you'll find a .lib file there.
Go to your project settings and open the linker settings. Under Input you should find additional dependencies. Add your .lib file(s) there. You also might need to add the folder where this .lib file(s) reside to the library folders (found under VC++-folders).
I have the german version of MSVC here, so your menu entries might be named slightly different, but you will find them ;)
Mark's answer was very helpful, but there were other issues. Following these step resolved it for me. Hopefully this will help someone in the future.
Step 1
The igraph package is a bunch of ".c" and ".h" files that was missing the ".lib" file in Mark's answer. It has to be open and build in Visual Studio. Then, the ".lib" file will appear in the "Debug" folder.
Step 2
Do the steps in Mark's answer.
However, in "VC++ Directories" there is a line call "Include Directories" where you have to store the path to your igraph include directory. This is so that Visual Studio can find the correct files when you write e.g. #include <include/igraph.h>.
Step 3
If you get a "...already defined in MSVCRTD.lib..." error. Then, visit this answer: How to resolve the following linker errors in Visual Studio?
Each of the libraries/subprojects that you are using must be compiled with the same option in "C/C++ -> Code Generation -> Runtime library".
I know a question like this was already asked, but the situation is a little different, and all the answers on that problem didn't work for me.
I'm trying to compile some C code in VS2008 and it doesn't create an exe. Also, when I try to run it with f5, I get:
This application has failed to start
because MSVCR90.DLL was not found.
I did some googling and it said that this was because my c++ redistributable package wasnt installed. So I installed that, restarted everything and tried again. But alas, I still get the same error. Does anyone have any clue how to fix this?
It sounds like either a problem with your VS2008 installation, or something wrong with your DLL search path. MSVCR90.DLL is installed when you install VS2008, you shouldn't have to install any additional redistributable packages.
First I would check your PATH environment variable and make sure there is no gobbledydook in it that will break some of the entries, and if you don't find a problem there, then I would uninstall and reinstall Visual Studio.
You could also try searching for MSVCR90.DLL (and other DLLs like it), and move them to your Windows/System32 folder.
If you just want to get going now, another thing you could do is change your project to statically link to the runtime libraries, and then it wont even try to load that DLL. Go to your Project settings, Configuration Properties->C/C++->Code Generation and change Runtime Library from Multi-Threaded DLL to just Multi-Threaded (or any of the options that doesn't end with DLL).
Here are some things to check for your configuration of the project- under the general tab:
.1 Configuration type - exe in your case.
.2 Use of MFC: if this is an MFC application it might be more portable if you do: Use MFC in a static library.
.3 Use of ATL - if not using atl (or not sure) say Not using ATL.
.4 Under C/C++ -> Runtime Library: Say Multi-threaded Debug (for debug version) or Multi-Threaded (for release version).
If you are getting specific linker errors that say something is already defined:
This means that you have some parts of your app (separate libs being linked to your exe) that are built with different runtime linking:
You can:
Make sure that these libraries were compiled with the same version of visual studio as your application.
Change those projects to use static runtime: C/C++ -> Code Generation -> Runtime LIbrary: /MT or MTd (same as #4 above)
If you still have some specific errors try telling the linker to ignore certain libraries: Go to Linker->Ignore Specific Library and put in the library that you want to ignore. This is most common for 'libcmt.lib' or 'libcmtd.lib'. It is important also to know that lib ending with 'd' is usually the debug version. If you are creating a release build and you are getting 'already defined in libcmtd.lib' that means that somewhere you are linking a release lib to a debug lib.
if you delete the manifest file associated with you .exe, you will get the same error.
MSVCR90.dll is not installed in system32, but in the side-by-side folder, hence the manifest is required.
I have just been bitten by this and this page got me working again.
The key is to ignore MSVCRT and MSVCR90 libraries for the debug configuration. Set your linker -> Input -> Ignore Specific Library setting to include the following:
MSVCRT
MSVCR90
it is supposedly in the http://www.microsoft.com/downloads/en/details.aspx?FamilyID=a5c84275-3b97-4ab7-a40d-3802b2af5fc2&displaylang=en visual studio 2008 runtime library. Yes! After installing that, openoffice update works.
If you give the finished exe to someone else they will need to install the latest visual c runtime to run it. This will only work for release build AFAIK. Visual studio should install the required runtime both release and debug into your path. The project probably has an additional dependency accidently set for an incorrect version of the runtime.
See if this page helps.
Go to your Project settings, Configuration Properties->C/C++->Code Generation and change Runtime Library from Multi-Threaded DLL to Multi-Threaded and then try to compile but it won't. Then change it to Multi-Threaded Debug and try to compile ,but it won't again and then you change it back to Multi-Threaded DLL and then it should compile and run.
I'm just starting out writing trying to write a simple program in C and I am using Visual Studios to do so. I heard that it does compile C as well as C++. And I know that it does because it says it compiles. The only problem is that when I go to the output directory, there isn't a .exe file in the directory! It has the following:
BuildLog.html
mt.dep
test1.obj
vc90.idb
vc90.pdb
But that is all! No EXE. I've looked through all the options and made sure that it is set to compile to an exe and i checked the output file. That is $(OutDir)\$(ProjectName).exe. But alas, no exe appears. Any ideas?
Also when i try to hit f5 and run with debut i get an error that says
This application has failed to start
because MSVCR90.DLL was not found.
Re-installing the application may fix
this problem
By default when you're creating a new C++ project within a new solution, you're getting folder structure like this:
C:\Projects\YourSolution
C:\Projects\YourSolution\YourCppProject
YourSolution contains YourSolution.sln and YourCppProject contains YourCppProject.vcproj.
When you build the solution, all intermediate files from YourCppProject are getting stored under YourCppProject\Debug or YourCppProject\Release, but resulting YourCppProject.exe goes under YourSolution\Debug or YourSolution\Release.
Your $(OutDir) is configured by General -> Output Directory. Check project configuration for YourCppProject and see that it uses $(SolutionDir) for the output.
is it a C/C++ console application?
did you use the project wizard to create it?
do you have a function like
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
printf("Hello, world!\n");
return 0;
}
in a .c module, typically main.c?
what happens when you hit F5 to run-with-debug?
what does your build log look like?
The simplest thing to do is just start over, making sure you choose the right kind of project.
To compile plain old C code with Visual Studio, choose Visual C++ > General > Empty Project from the New Project menu. This creates 3 empty folders: Header Files, Resource Files, and Source Files. Right click on Source Files, choose Add > New Item. Then add a main.cpp, rename it to main.c, and start coding.
http://msdn.microsoft.com/en-us/library/ms235299.aspx
Note:
It is not supported to redistribute
C/C++ applications that are built
without a manifest. Visual C++
libraries cannot be used by C/C++
applications without a manifest
binding the application to these
libraries. For more information, see
Choosing a Deployment Method.
If the DLL is not reachable and
Windows cannot load this DLL for your
application, you may get the following
error message:
This application has failed to start
because MSVCR90.dll was not found.
Re-installing the application may fix
this problem.
To resolve these errors, you must make
sure that your application is built
correctly and Visual C++ libraries are
correctly deployed on the target
system. To identify the root cause of
these run-time errors, follow the
steps outlined in Troubleshooting
C/C++ Isolated Applications and
Side-by-side Assemblies.
HTH
Sounds like you only hit compile, that will give you you're .obj file, but you still need to click build.