I've spent the last 5 hours trying to link a binary file to my program, I am using eclipse + MinGW, and trying to include the FreeImage source (downloaded from internet), the thing is I am unable to include the .lib file since it doesn't work, so I am trying to convert it to .a file.
I used MSYS software in order to do it, but nothing is working, the errors go, but the the program just fails/crashes.
Is there a way to convert .lib files to .a files so I can include them to my program.
Please help me, I really need this, and I've looked so hard to find some solutions, nothing worked, someone please direct me.
Thanks in advance <3
See this answer. It recommends http://code.google.com/p/lib2a/
You must compile opencv with gcc-mingw. gcc-mingw compiles for a different operating system - mingw is a subset of Linux. Libraries compiled for Windows are simply not compatible.
You can easily find instructions for building opencv for mingw using google, or here:
Getting started with OpenCV 2.4 and MinGW on Windows 7
You'll also need to compile FreeImage, the source code for FreeImage is available at http://freeimage.sourceforge.net/download.html
Related
first i have simple code with c++ and opencv
its no matter what is the code
now in windows i used visual studio and i add the open cv library to visual stuio and compile it and its work but when i send it to another pc its need open cv library its hard to send all library so i find the program need some files like
opencv_highgui2410.dll
..... .dll
opencv_objdetect2410.dll
that's make my program run without the library
now i turned to ubuntu linux after i compile with codeblocks
this photo will show you how i linker the library
and
and i build the program and run it its work now when i sent the program to another pc its give an error some files not found like
error while loading shared libraries: libopencv_core.so.2.4
i copy this file libopencv_core.so.2.4 and add it beside the program still same error seems not like windows
any solution made me compile opencv program and run program without need full library just some of its file
or any idea to add files (libs) that's project needed to run beside program just like windows
I think this should help you.
But from the comments, i fear you have very little linux experience, I hope this will help, anyway:
https://s1meonov.wordpress.com/2010/12/27/opencv-static-linking-gnulinux-gcc/
(first, be sure to understand what shared and static libraries, how they work and how they impact on software licenses, and also be sure to understand how to install programs in linux. For installing have a look at this link: http://www.makeuseof.com/tag/beginners-guide-installing-software-ubuntu-apt/)
I wrote a small program (osx, c++) for image joining using opencv2 but I ran into a problem trying to send it to my friend who i wrote it for. The problem is that I only found two ways to build opencv2 and I could only build it into .dylib and .a files. I didn't know how to properly compile with the .a files and when i compile with .dylib files I couldn't make the program find them on another computer. How do I distribute a program that uses .dylib files for osx. I found a few answers to similar questions that mentioned changing the Dynamic Library Install Name in xcode and using the install_name_tool, but neither one of those helped or maybe I just used them wrong. I also tried finding a way to build opencv2 into a .framework for osx (not ios), but had no luck in my searches. I don't know where else to turn at this point.
Sorry if this all seems too simple but I'm a beginner and I'm trying to use the OpenBlas libraries in my C++ IDE "CodeBlocks" on Windows. More specifically, I'm want to use the matrix-vector multiplication and solving of a tri-diagonal matrix system libraries. I've downloaded the files at the bottom of the page on the OpenBlas site. I'm not sure how I would even start, as there are little/no resources online for beginners such as myself. What libraries do I need to include in my .cpp file preamble, have I even downloaded the correct set of files, which files do I need to include in my working directory, etc?
Thanks in advance.
EDIT: I've downloaded the pre-built files as recommended and followed every step in the link below.
http://www.learncpp.com/cpp-tutorial/a3-using-libraries-with-codeblocks/
I have also included #include "cblas.h" in the preamble of my .cpp file but I am getting a undefined reference to 'cblas_XXXXX' error in my build messages. What is the reason for this?
Download the pre-built winodws library
https://sourceforge.net/projects/openblas/files/v0.2.15/OpenBLAS-v0.2.15-Win64-int32.zip/download
I'm running 32-bit Windows 7 Enterprise and CodeBlocks 10.05.
I followed this tutorial to set up OpenCV 2.2 to work with CodeBlocks.
Any programs that use the C CodeBlocks API work fine - they compile, link, and run fine.
However, when I try to use C++ OpenCV functions and objects, .o files are generated, but I get linking errors, such as:
undefined reference to `cv::cvtColor(cv::Mat const&, cv::Mat&, int, int)'
After some Googling, I found that this was because I didn't include enough libraries in my search directories. However, I don't know what libraries to include.
After some searching in my OpenCV folder, I found some .a files in 3rdParty/lib and added them, too. But my problem persists.
Does anyone know what libraries I have to include in order to get my program to work?
If you need more information, please tell me and I'll give it to you.
I had the same problem and tried the above which did not work and I have downloaded the precompiled OpenCV.
So what worked for me was to include the following header.
include opencv2\imgproc\imgproc.hpp
Hope this helps.
You need to include the libopencv_imgproc library.
If you are using eclipse
Of course , I assume you have already compiled the source folder with CMake. If you haven't done already refer to this video
https://www.youtube.com/watch?v=kVyVEHK4qfQ
In the first 8 min, you will learn every configuration.
I've been trying to get the boost library working with Code::Blocks and am having some trouble.
When I first tried to get boost, all I did was download the latest zip file and extract it into the CodeBlocks folder. Then I set the compiler settings to look in the boost folder. This allowed me to compile, but not to link. I then read the BoostWindowsQuickReference. I removed everything I had related to boost from my machine, and started fresh.
I followed the instructions step by step, and the only thing that didn't go exactly as the instructions said was that the install-proper folder with the include\boost inside of it was in C: and not my CodeBlocks folder. So I simply copied it (just in case for some reason it needed to be there) to the CodeBlocks folder, which I thought odd because I already had a boost_1_40_0 folder there from downloading the .zip.
I then tried to compile a program and it came up with the exact same error. Then I realized that I forgot to put in the link library (Ex: boost_regex-mgw44-mt-1_40.lib). Now I get
error: ld.exe||cannot find -lboost_regex-mgw44-mt-1_40.lib|
I have a few questions:
Obviously, what am I doing wrong?
Will I need to put in a link library every time I want to use a boost facility (everything is separated into different files, there isn't just one big project.)
Was it necessary to build the library with the boost-jam or could I have just extracted it and used it? (Probably a dumb question, but a small seed of doubt was planted when I got the exact same error.)
Should I try nuwen's MinGW Distro? (Would it make things any easier?)
If any clarification is needed I'd be happy to do so. Thanks.
Edit: and now I can't compile regular programs. So I'm just starting fresh again.
1, it should be -lboost_regex-mgw44-mt-1_40
2, Read the document, most boost library doesn't require to link library
3,4, You should compile it yourself, or try nuwen's MinGW ( I'd installed it and it worked fine )
BoostPro has Windows binaries available for the Boost libraries. If you download just the Boost sources, you will have to compile it, if you are using any of the libraries that are not header-only (such as boost regex). The BoostPro binaries will allow you to link to these without having to build anything.
On Windows it doesn't really matter where you "install" Boost to. Just get the .7z, compile using bjam.exe and pass it the options you need. It will create a folder called "bin.v2" and put the resulting libs in there. In Code::Blocks, all you need to do is edit the project options and point the search path to boost_1_40_0\boost and manually input the libraries to link against (those from bin.v2). It should just work then.
Do not use a precompiled Boost library.