I followed steps in this SO link to compile a sample program using OpenCV2.4.0 in windows. I made a setup both in DEVC++ and NetBeans with Mingw. My sample Program is getting Compiled properly, but when I run the exe the application get crashes.
But In same machine I used opencv2.1.0 and the same sample program gets compiled and there is no crash while running it.
The below is the Sample Code I tried to execute:
#include "highgui.h"
using namespace std;
int main( int argc, char** argv ) {
IplImage* img = cvLoadImage( "C:\\Documents and Settings\\All Users\\Documents\\My Pictures\\Sample Pictures\\Water lilies.jpg" );
cvNamedWindow( "Sample", CV_WINDOW_AUTOSIZE );
cvShowImage( "Sample", img );
cvWaitKey(0);
cvReleaseImage( &img );
cvDestroyWindow( "Sample" );
}
UPDATE :
I follwed as the steps as moskito-x link to build the opencv and when I press "configure", I get the following error. And my make file is also 35kb in size.
Any suggestions to solve this?
Using the libs in "...\opencv\build\x86\mingw\bin" and "...\opencv\build\x86\mingw\lib
You can not use the libraries that come with OpenCV-2.4.x.exe.
As some developers in forums and I find out. On some systems, the precompiled libs of "opencv 2.4.x" can not be used.
To compile your own programs, works, but it crashed if you try to run them. Until there are not functioning precompiled libs of "opencv 2.4.x , you have to compile opencv yourself.
Ignore so the folder "...\opencv\build\x86\mingw\bin" and "...\opencv\build\x86\mingw\lib" completely.
As already pointed out you can't rely on precompiled binaries. I also had a lot of problems and finally ended up with compiling my own binaries. My setup was for Windows7, Eclipse CDT (Juno) and MinGW. You can check my post on Stackoverflow here
I guess this is an error related to memory management. Maybe because your'e releasing the window before the image. But anyhow you should use the OpenCV C++ interface, as this does a lot of stuff automagically. With the C++ Interface your code would look like this:
#include <opencv.hpp>
int main( int argc, char** argv ) {
cv::Mat img = cv::imread("C:\\Documents and Settings\\All Users\\Documents\\My Pictures\\Sample Pictures\\Water lilies.jpg");
cv::imshow("Sample", img);
cv::waitKey(0);
return 0
}
Related
I am trying to setup googletest in Eclipse. I really got stuck.
I downloaded the current googletest version 1.13.0. fuse_gtest_files.py is not included in this version (which is often referred to in instructions).
Anyway, I set up an empty c++ project (GCC C++ compiler). Then I added the include paths for the gtest header files (compare picture).
enter image description here
Afterwards, I tried to compile the code. I got the error message "undefined reference to `testing::InitGoogleTest(int*, char**)'" - Reason: It could not find the related .cc files.
#include "gtest/gtest.h"
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
So I added the source Location of the cc files (compare Screenshot).
enter image description here
Now, the function is found. But I get a bunch of errors "multiple definition of xx"
C:/xxx/tools/googletest-1.13.0/googletest/src/gtest-assertion-result.cc:45: multiple definition of testing::AssertionResult::AssertionResult(testing::AssertionResult const&)'
src\gtest-all.o:C:/xxx/tools/googletest-1.13.0/googletest/src/gtest-assertion-result.cc:45: first defined here.`
Does anyone has an idea?
Thanks
Jenny
This might be a very dumb question...
I'm trying to use Boost.Python in an Xcode project (boost 1.50, xcode 4.4, OS X 10.8). I installed both boost and python through macports. I dragged the macports Python framework (/opt/local/Library/Frameworks/Python.framework) into the project and tried the most minimal program possible:
#include <boost/python.hpp>
int main(int argc, const char * argv[]) {
Py_Initialize();
Py_Finalize();
return 0;
}
and get:
/opt/local/include/boost/python/detail/wrap_python.hpp:50:11: fatal error: 'pyconfig.h' file not found
Do I need to explicitly add the framework header folder to the project's header search paths? That seems irregular... so hopefully I'm just misunderstanding something?
Is there a way to get Eclipse (Indigo) to know about the built-in variables and functions that are available to CUDA kernels?
Consider the following simple kernel
__global__ void myKernel()
{
int x = threadIdx.x;
__syncthreads();
}
The Eclipse IDE highlights "threadIdx" and "__syncthreads" with a "Symbol 'the built-in symbol' could not be resolved" error message. Is there a way to tell Eclipse these are actually implicitly defined?
flipchart is correct. #include <cuda_runtime_api.h> does the trick if the symbol __CUDACC__ is defined beforehand.
In cuda 11.3 you can add:
#include <device_launch_parameters.h>
I just installed MinGW + MSYS in Windows XP using graphical installer. Everything seems fine.
However, when I try to build a C++ application using ./configure, make, make install, it shows error message. The following 2 checkings failed:
AC_CHECK_LIB(m, memcpy, [], [AC_MSG_ERROR([error msg])])
AC_CHECK_FUNC(memcpy, [],[AC_MSG_ERROR([error msg])])
Why my MinGW couldn't find memcpy and its library? Can anyone give me suggestion how to fix this error? Thank you.
void * memcpy ( void * destination, const void * source, size_t num );
Copy block of memory, copies the values of num bytes from the location pointed by source directly to the memory block pointed by destination.
For reference please see http://www.cplusplus.com/reference/cstring/memcpy/
I would like to use valgrind to detect leaks on iPhoneSimulator. I got the source for valgrind, compiled and installed. Added the following to my code
int main(int argc, char *argv[]) {
#ifdef VALGRIND_REXEC
if (argc = 2 && strcmp(argv[1], "-valgrind") != 0)) {
execl(VALGRIND, VALGRIND, "--leak-check=full", "--dsymutil=yes", argv[0], "-valgrind", NULL);
}
#endif
VALGRIND_REXEC is defined, when I try to Debug or Run my application I get the following error in the console
[Session started at 2011-03-14 16:21:27 +0000.]
Detected an attempt to call a symbol in system libraries that is not present on the iPhone:
open$UNIX2003 called from function main in image valgrind.
If you are encountering this problem running a simulator binary within gdb, make sure you 'set start-with-shell off' first.
Mac 10.6.5
Xcode 3.2.5
iOS 4.2
Do I need to compile valgrind in any special way, what am I doing wrong?
Out of random curiosity, is there a reason the "Leaks" tool in Xcode won't do what you need it to?
Relevant SO question.