我想用Angstrom Linux編譯我的BeagleBoard中的源代碼。 昨天我能夠編譯我的代碼。但今天我不能編譯代碼和它說:gcc cc1:內存不足分配
ccl: out of memory allocating 268439608 bytes after a total of 405504 bytes
make *** [getimagefromcam1.o] Error 1
我的編譯字符串爲:
gcc getimagefromcam1.c `pkg-config --cflags --libs opencv` -o getimagefromcam1 -lpthread
代碼是:
#include <cv.h>
#include <highgui.h>
#include <cxcore.h>
#include <stdio.h>
int main(int argc, char* argv[])
{
CvCapture* camera = cvCreateCameraCapture(0); // Use the default camera
IplImage* frame = 0;
IplImage img;
cvSetCaptureProperty(camera,CV_CAP_PROP_FRAME_WIDTH,2016) ;
cvSetCaptureProperty(camera,CV_CAP_PROP_FRAME_HEIGHT,1512);
frame = cvQueryFrame(camera); //need to capture at least one extra frame
frame = cvQueryFrame(camera);
if (frame != NULL) {
printf("got frame 1\n\r");
cvSaveImage("webcam1.jpg", frame,0);
} else {
printf("Null frame 1\n\r");
}
frame = cvQueryFrame(camera); //need to capture at least one extra frame
frame = cvQueryFrame(camera);
if (frame != NULL) {
printf("got frame 1\n\r");
cvSaveImage("webcam1.jpg", frame,0);
} else {
printf("Null frame 1\n\r");
}
cvReleaseCapture(&camera);
return 0;
}
當我寫 「無」 是說
total used free shared buffers cached
Mem: 241260 221256 20004 0 13748 116184
-/+ buffers/cache: 91324 149936
Swap: 0 0 0
我該如何解決它?
你使用的是什麼版本的'gcc'?嘗試升級到最新版本(例如4.7或至少4.6)。 –