error adding symbols: File in wrong format collect2: error: ld returned 1 exit status
Escrevi este pequeno código para testar o uso do opencv.(I wrote this little code to test the opencv use.)
//teste.cpp-----------------------------------------------------------------------------
#include </usr/local/include/opencv/highgui.h>
int main(int argc, char** argv)
{
IplImage* img = cvLoadImage (argv[1]);
cvNamedWindow ("Exemplo 1", CV_WINDOW_AUTOSIZE);
cvShowImage ("Exemplo 1", img);
cvWaitKey(0);
cvReleaseImage(&img);
cvDestroyWindow("Exemplo 1");
}
Porém quando tento compilar no terminal, usando: (but when I try to build in terminal mode using:)
gcc -o teste teste.cpp pkg-config --libs opencv
recebo esta mensagem: (I received this message:) /usr/local/lib/libopencv_calib3d.so: error adding symbols: File in wrong format collect2: error: ld returned 1 exit status
como corrigir isso? ( how to fix this?)
3 things wrong here:
your question is in
chineseportugese, noone will be able to read it. ask in english, please.you're trying to use C. this is no more possible, you will have to use C++. (use cv::Mat, and g++)
do not try to pass an absolute path with include, rather
#include <opencv2/opencv.hpp>
Tank you Berak! I tranlate this via google!
btw, can you try to run
pkg-config --libs opencv
on the cmsline, to see what it outputs ?i'm wondering, why it tried to link to an .so file instead of an .a