Miniupnpc on Windows - bazel

Does anyone know how to link against miniupnpc (https://github.com/miniupnp/miniupnp/tree/master/miniupnpc) on Windows 10? I am using bazel 5.0. I am using msys2 and the mingw-gcc compiler. I am linking against the static form using -DMINIUPNP_STATICLIB. I compiled it by typing make install. I also tried mingw32make.bat but the fails with a different error. I get the following error when linking.
c:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: external/miniupnp/miniupnpc/libminiupnpc.a(miniupnpc.o):miniupnpc.c:(.text+0x496): undefined reference to `if_indextoname'
c:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: external/miniupnp/miniupnpc/libminiupnpc.a(connecthostport.o):connecthostport.c:(.text+0x180): undefined reference to `gai_strerror'
c:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: external/miniupnp/miniupnpc/libminiupnpc.a(connecthostport.o):connecthostport.c:(.text+0x188): undefined reference to `__getreent'
c:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: external/miniupnp/miniupnpc/libminiupnpc.a(connecthostport.o):connecthostport.c:(.text+0x1da): undefined reference to `__errno'
c:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: external/miniupnp/miniupnpc/libminiupnpc.a(connecthostport.o):connecthostport.c:(.text+0x1ed): undefined reference to `__errno'
c:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: external/miniupnp/miniupnpc/libminiupnpc.a(connecthostport.o):connecthostport.c:(.text+0x3b4): undefined reference to `__errno'
c:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: external/miniupnp/miniupnpc/libminiupnpc.a(connecthostport.o):connecthostport.c:(.text+0x3c3): undefined reference to `__errno'
c:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: external/miniupnp/miniupnpc/libminiupnpc.a(connecthostport.o):connecthostport.c:(.text+0x3d1): undefined reference to `__errno'
c:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: external/miniupnp/miniupnpc/libminiupnpc.a(minissdpc.o):minissdpc.c:(.text+0xc24): undefined reference to `ioctl'
c:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: external/miniupnp/miniupnpc/libminiupnpc.a(minissdpc.o):minissdpc.c:(.text+0xd00): undefined reference to `gai_strerror'
c:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: external/miniupnp/miniupnpc/libminiupnpc.a(minissdpc.o):minissdpc.c:(.text+0xd08): undefined reference to `__getreent'
c:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: external/miniupnp/miniupnpc/libminiupnpc.a(minissdpc.o):minissdpc.c:(.text+0x14f6): undefined reference to `if_nametoindex'
c:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: external/miniupnp/miniupnpc/libminiupnpc.a(minissdpc.o):minissdpc.c:(.text+0x151d): undefined reference to `__getreent'
c:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: external/miniupnp/miniupnpc/libminiupnpc.a(miniwget.o):miniwget.c:(.text+0x414): undefined reference to `__locale_ctype_ptr'
c:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: external/miniupnp/miniupnpc/libminiupnpc.a(miniwget.o):miniwget.c:(.text+0x84c): undefined reference to `gai_strerror'
c:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: external/miniupnp/miniupnpc/libminiupnpc.a(miniwget.o):miniwget.c:(.text+0x854): undefined reference to `__getreent'
c:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: external/miniupnp/miniupnpc/libminiupnpc.a(miniwget.o):miniwget.c:(.text+0xb51): undefined reference to `if_nametoindex'
c:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: external/miniupnp/miniupnpc/libminiupnpc.a(receivedata.o):receivedata.c:(.text+0x4b): undefined reference to `poll'
c:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: external/miniupnp/miniupnpc/libminiupnpc.a(receivedata.o):receivedata.c:(.text+0x5a): undefined reference to `__errno'

You need to run the following commands
cmake .
make
./mingw32make.bat
Then you need to use the libminiupnc.dll.a

Related

Clang-3.8 undefined reference to `main' when compiling object file from llvm bytecode with global variables

I'm trying to implement nested functions in llvm through the C++ API. After i perform a semantic check (to assure that the program which is going to be compiled has correct nesting references etc) i define all function in the same scope in llvm and set all variables as global. I was expecting this to work but i found myself having huge problem while getting an executable from an .o file with the command:
"llvm-as-3.8 output.ll| llc-3.8 -filetype=obj | clang-3.8 ../library/library.a -v -o out"
By using either llvm::GlobalValue::WeakAnyLinkage or llvm::GlobalValue::ExternalLinkage linkage for global variables i get:
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 0 has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 1 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_info): relocation 8 has invalid symbol index 12
...
/usr/bin/ld: /usr/lib/debug/usr/lib/x86_64-linux-gnu/crt1.o(.debug_line): relocation 0 has invalid symbol index 2
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
Which seems to have to do with the definition of main, who in the definition of my ir code stands as:
; Function Attrs: nounwind uwtable
define void #main() #0 {
The thing is that the same command didn't have any problem when i didn't use global variables except of course the case where a variable was used in a child function, which was the reason i tried to change alloca to global.
Help find a solution to this problem.
Thanks in advance.
Note1: I use llvm-3.8
UPDATE:
when i removed -v from the clang command the result was:
refined_output.o: In function bsort':
refined_output.ll:(.text+0x4): undefined reference tox'
refined_output.ll:(.text+0xa): undefined reference to n'
refined_output.ll:(.text+0x10): undefined reference tochanged'
refined_output.ll:(.text+0x22): undefined reference to i'
refined_output.ll:(.text+0x2c): undefined reference tochanged'
refined_output.ll:(.text+0x42): undefined reference to i'
refined_output.ll:(.text+0x48): undefined reference ton'
refined_output.ll:(.text+0x50): undefined reference to i'
refined_output.ll:(.text+0x59): undefined reference tox'
refined_output.ll:(.text+0x60): undefined reference to i'
refined_output.ll:(.text+0x75): undefined reference tox'
refined_output.ll:(.text+0x7c): undefined reference to i'
refined_output.ll:(.text+0x95): undefined reference tochanged'
refined_output.ll:(.text+0xa3): undefined reference to changed'
refined_output.o: In functionswap':
refined_output.ll:(.text+0xc3): undefined reference to x.1'
refined_output.ll:(.text+0xca): undefined reference toy'
refined_output.ll:(.text+0xd1): undefined reference to x.1'
refined_output.ll:(.text+0xd9): undefined reference tot'
refined_output.ll:(.text+0xe0): undefined reference to x.1'
refined_output.ll:(.text+0xe7): undefined reference toy'
refined_output.ll:(.text+0xf2): undefined reference to y'
refined_output.ll:(.text+0xf8): undefined reference tot'
refined_output.o: In function main':
refined_output.ll:(.text+0x102): undefined reference toi.4'
refined_output.ll:(.text+0x10c): undefined reference to seed'
refined_output.ll:(.text+0x123): undefined reference tox.2'
refined_output.ll:(.text+0x12a): undefined reference to i.4'
refined_output.ll:(.text+0x130): undefined reference toseed'
refined_output.ll:(.text+0x15d): undefined reference to seed'
refined_output.ll:(.text+0x166): undefined reference toi.4'
refined_output.ll:(.text+0x16c): undefined reference to i.4'
refined_output.ll:(.text+0x177): undefined reference tox.2'
refined_output.ll:(.text+0x18d): undefined reference to x.2'
refined_output.ll:(.text+0x19e): undefined reference tox.2'
refined_output.o: In function printArray':
refined_output.ll:(.text+0x1c4): undefined reference tomsg'
refined_output.ll:(.text+0x1cb): undefined reference to x.2'
refined_output.ll:(.text+0x1d1): undefined reference ton.3'
refined_output.ll:(.text+0x1d8): undefined reference to msg'
refined_output.ll:(.text+0x1e3): undefined reference toi.4'
refined_output.ll:(.text+0x1f3): undefined reference to x.2'
refined_output.ll:(.text+0x1fa): undefined reference toi.4'
refined_output.ll:(.text+0x208): undefined reference to i.4'
refined_output.ll:(.text+0x20e): undefined reference toi.4'
refined_output.ll:(.text+0x214): undefined reference to n.3'
refined_output.ll:(.text+0x21c): undefined reference toi.4'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Where all this variables were defined at the start of my program in llvm IR as:
#x = external global i32*
#n = external global i32
#i = external global i32
#changed = external global i1
#x.1 = external global i32*
#y = external global i32*
#t = external global i32
#msg = external global i8*
#x.2 = external global i32*
#n.3 = external global i32
#i.4 = external global i32
#const_string_temp = private constant [3 x i8] c", \00", align 1
#const_string_temp.5 = private constant [2 x i8] c"\0A\00", align 1
#i.6 = external global i32
#x.7 = external global i32
#seed = external global i32
#const_string_temp.8 = private constant [16 x i8] c"Initial array: \00", align 1
#const_string_temp.9 = private constant [15 x i8] c"Sorted array: \00", align 1
I hope this helps you help me --- or else find the problem in my IR code generation.
I'm looking forward to it..
#x = external global i32*
and so on are global variable declarations, not definitions. Therefore, the "undefined reference" error is valid and you really need to define them.
See http://llvm.org/docs/LangRef.html#global-variables for more information
Also note that llvm-as / llc part is redundant - clang could compile .ll / .bc files just fine.

Problems with OpenCV compilation with static linking on pandaboard

I installed opencv with static linking on pandaboard using BUILD_SHARED_LIBS=0 option. I am using ubuntu 11.10. I also built 3rd party libraries png, jpeg, jasper and zlib. (cmake options BUILD_PNG=ON BUILD_JASPER=ON BUILD_JPEG=ON BUILD_ZLIB=ON WITH_JPEG=ON WITH_PNG=ON WITH_JASPER=ON). My opencv installation was successful. However when I compile a test program I get a number of undefined reference to errors. All of these errors seem to be related to jpeg, png and jasper libraries but i can't understand why libhighgui is not able to refer to 3rd party libraries when I explicitly link them. Here is how I compile my program :
g++ -static face_recognition.cpp -o fcarm -I/home/nandhini/opencv/2.4.2static/include/opencv -I/home/nandhini/opencv/2.4.2static/include -L/home/nandhini/opencv/2.4.2static/lib/ -L/home/nandhini/opencv/2.4.2static/share/OpenCV/3rdparty/lib -llibjpeg -llibjasper -llibpng -lzlib -lopencv_core -lopencv_contrib -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_flann -lopencv_photo -lopencv_legacy -pthread -lm -lrt -lstdc++ -ldl
I've been stuck with this problem for a long time now and I would really appreciate it if someone can help me solve the problem. Please help, thanks !
Here is a list of my errors :
/home/nandhini/opencv/2.4.2static/lib//libopencv_core.a(persistence.cpp.o): In functionicvGets(CvFileStorage*, char*, int)':
persistence.cpp:(.text._ZL7icvGetsP13CvFileStoragePci+0x7e): undefined reference to gzgets'
/home/nandhini/opencv/2.4.2static/lib//libopencv_core.a(persistence.cpp.o): In function_ZL16icvYMLSkipSpacesP13CvFileStoragePcii.constprop.61':
persistence.cpp:(.text._ZL16icvYMLSkipSpacesP13CvFileStoragePcii.constprop.61+0x11e): undefined reference to gzeof'
/home/nandhini/opencv/2.4.2static/lib//libopencv_core.a(persistence.cpp.o): In functionicvPuts(CvFileStorage*, char const*)':
persistence.cpp:(.text._ZL7icvPutsP13CvFileStoragePKc+0x138): undefined reference to gzputs'
/home/nandhini/opencv/2.4.2static/lib//libopencv_core.a(persistence.cpp.o): In functionicvXMLSkipSpaces(CvFileStorage*, char*, int)':
persistence.cpp:(.text._ZL16icvXMLSkipSpacesP13CvFileStoragePci+0x1a2): undefined reference to gzeof'
/home/nandhini/opencv/2.4.2static/lib//libopencv_core.a(persistence.cpp.o): In functionicvClose(CvFileStorage*, std::basic_string, std::allocator >*)':
persistence.cpp:(.text._ZL8icvCloseP13CvFileStoragePSs+0x132): undefined reference to gzclose'
/home/nandhini/opencv/2.4.2static/lib//libopencv_core.a(persistence.cpp.o): In functioncvOpenFileStorage':
persistence.cpp:(.text.cvOpenFileStorage+0x1b0): undefined reference to gzrewind'
persistence.cpp:(.text.cvOpenFileStorage+0x6b6): undefined reference togzclose'
persistence.cpp:(.text.cvOpenFileStorage+0x734): undefined reference to gzopen'
persistence.cpp:(.text.cvOpenFileStorage+0xcd4): undefined reference togzclose'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_jpeg2000.cpp.o): In function cv::JasperInitializer::~JasperInitializer()':
grfmt_jpeg2000.cpp:(.text._ZN2cv17JasperInitializerD2Ev[_ZN2cv17JasperInitializerD5Ev]+0x4): undefined reference tojas_cleanup'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_jpeg2000.cpp.o): In function cv::Jpeg2KDecoder::close()':
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder5closeEv+0x8): undefined reference tojas_stream_close'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder5closeEv+0x14): undefined reference to jas_image_destroy'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_jpeg2000.cpp.o): In functioncv::Jpeg2KDecoder::readHeader()':
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder10readHeaderEv+0xe): undefined reference to jas_stream_fopen'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder10readHeaderEv+0x1e): undefined reference tojas_image_decode'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_jpeg2000.cpp.o): In function cv::Jpeg2KDecoder::readData(cv::Mat&)':
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x5c): undefined reference tojas_image_getcmptbytype'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x68): undefined reference to jas_image_getcmptbytype'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x74): undefined reference tojas_image_getcmptbytype'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0xb8): undefined reference to jas_image_getcmptbytype'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x126): undefined reference tojas_matrix_create'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x13e): undefined reference to jas_image_readcmpt'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x16e): undefined reference tojas_matrix_destroy'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x184): undefined reference to jas_cmprof_createfromclrspc'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x194): undefined reference tojas_image_chclrspc'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x1a2): undefined reference to jas_image_destroy'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x1ac): undefined reference tojas_cmprof_destroy'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KDecoder8readDataERNS_3MatE+0x220): undefined reference to jas_cmprof_destroy'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_jpeg2000.cpp.o): In functioncv::Jpeg2KEncoder::writeComponent8u(void*, cv::Mat const&)':
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder16writeComponent8uEPvRKNS_3MatE+0x1c): undefined reference to jas_matrix_create'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder16writeComponent8uEPvRKNS_3MatE+0x86): undefined reference tojas_image_writecmpt'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder16writeComponent8uEPvRKNS_3MatE+0xa0): undefined reference to jas_matrix_destroy'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_jpeg2000.cpp.o): In functioncv::Jpeg2KEncoder::writeComponent16u(void*, cv::Mat const&)':
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder17writeComponent16uEPvRKNS_3MatE+0x1c): undefined reference to jas_matrix_create'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder17writeComponent16uEPvRKNS_3MatE+0x86): undefined reference tojas_image_writecmpt'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder17writeComponent16uEPvRKNS_3MatE+0xa0): undefined reference to jas_matrix_destroy'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_jpeg2000.cpp.o): In functioncv::Jpeg2KEncoder::write(cv::Mat const&, std::vector > const&)':
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x5a): undefined reference to jas_image_create'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x8c): undefined reference tojas_image_destroy'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0xbe): undefined reference to jas_stream_fopen'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0xcc): undefined reference tojas_image_strtofmt'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0xda): undefined reference to jas_image_encode'
grfmt_jpeg2000.cpp:(.text._ZN2cv13Jpeg2KEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0xe8): undefined reference tojas_stream_close'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_jpeg2000.cpp.o): In function _GLOBAL__sub_I_grfmt_jpeg2000.cpp':
grfmt_jpeg2000.cpp:(.text.startup._GLOBAL__sub_I_grfmt_jpeg2000.cpp+0x2): undefined reference tojas_init'
/home/nandhini/opencv/2.4.2static/lib//libopencv_imgproc.a(templmatch.cpp.o): In function cv::crossCorr(cv::Mat const&, cv::Mat const&, cv::Mat&, cv::Size_<int>, int, cv::Point_<int>, double, int)':
templmatch.cpp:(.text._ZN2cv9crossCorrERKNS_3MatES2_RS0_NS_5Size_IiEEiNS_6Point_IiEEdi+0x318): undefined reference tocv::getOptimalDFTSize(int)'
templmatch.cpp:(.text._ZN2cv9crossCorrERKNS_3MatES2_RS0_NS_5Size_IiEEiNS_6Point_IiEEdi+0x33c): undefined reference to cv::getOptimalDFTSize(int)'
templmatch.cpp:(.text._ZN2cv9crossCorrERKNS_3MatES2_RS0_NS_5Size_IiEEiNS_6Point_IiEEdi+0x7c4): undefined reference tocv::dft(cv::_InputArray const&, cv::_OutputArray const&, int, int)'
templmatch.cpp:(.text._ZN2cv9crossCorrERKNS_3MatES2_RS0_NS_5Size_IiEEiNS_6Point_IiEEdi+0xefc): undefined reference to cv::dft(cv::_InputArray const&, cv::_OutputArray const&, int, int)'
templmatch.cpp:(.text._ZN2cv9crossCorrERKNS_3MatES2_RS0_NS_5Size_IiEEiNS_6Point_IiEEdi+0xf66): undefined reference tocv::mulSpectrums(cv::_InputArray const&, cv::_InputArray const&, cv::_OutputArray const&, int, bool)'
templmatch.cpp:(.text._ZN2cv9crossCorrERKNS_3MatES2_RS0_NS_5Size_IiEEiNS_6Point_IiEEdi+0xf8e): undefined reference to cv::dft(cv::_InputArray const&, cv::_OutputArray const&, int, int)'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_png.cpp.o): In functioncv::PngDecoder::readDataFromBuf(void*, unsigned char*, unsigned int)':
grfmt_png.cpp:(.text._ZN2cv10PngDecoder15readDataFromBufEPvPhj+0xc): undefined reference to png_get_io_ptr'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder15readDataFromBufEPvPhj+0x10a): undefined reference topng_error'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_png.cpp.o): In function cv::PngDecoder::close()':
grfmt_png.cpp:(.text._ZN2cv10PngDecoder5closeEv+0x26): undefined reference topng_destroy_read_struct'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_png.cpp.o): In function cv::PngDecoder::readHeader()':
grfmt_png.cpp:(.text._ZN2cv10PngDecoder10readHeaderEv+0x18): undefined reference topng_create_read_struct'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder10readHeaderEv+0x22): undefined reference to png_create_info_struct'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder10readHeaderEv+0x2a): undefined reference topng_create_info_struct'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder10readHeaderEv+0x6a): undefined reference to png_set_longjmp_fn'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder10readHeaderEv+0xae): undefined reference topng_init_io'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder10readHeaderEv+0xd8): undefined reference to png_read_info'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder10readHeaderEv+0xf0): undefined reference topng_get_IHDR'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder10readHeaderEv+0x166): undefined reference to png_set_read_fn'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_png.cpp.o): In functioncv::PngEncoder::write(cv::Mat const&, std::vector > const&)':
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x18): undefined reference to png_create_write_struct'
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x7a): undefined reference topng_create_info_struct'
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x9e): undefined reference to png_set_longjmp_fn'
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0xce): undefined reference topng_set_write_fn'
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x14a): undefined reference to png_set_compression_mem_level'
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x158): undefined reference topng_set_compression_strategy'
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x19a): undefined reference to png_set_IHDR'
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x1ae): undefined reference topng_write_info'
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x1ba): undefined reference to png_set_bgr'
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x1ce): undefined reference topng_set_swap'
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x208): undefined reference to png_write_image'
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x21c): undefined reference topng_write_end'
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x22e): undefined reference to png_destroy_write_struct'
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x284): undefined reference topng_init_io'
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x2c6): undefined reference to png_set_filter'
grfmt_png.cpp:(.text._ZN2cv10PngEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x2d4): undefined reference topng_set_compression_level'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_png.cpp.o): In function cv::PngDecoder::readData(cv::Mat&)':
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x8c): undefined reference topng_set_longjmp_fn'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0xfa): undefined reference to png_set_gray_to_rgb'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x102): undefined reference topng_read_update_info'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x126): undefined reference to png_read_image'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x12e): undefined reference topng_read_end'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x14e): undefined reference to png_set_palette_to_rgb'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x16a): undefined reference topng_set_rgb_to_gray'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x170): undefined reference to png_set_bgr'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x178): undefined reference topng_set_strip_alpha'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x180): undefined reference to png_set_swap'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x18c): undefined reference topng_set_expand_gray_1_2_4_to_8'
grfmt_png.cpp:(.text._ZN2cv10PngDecoder8readDataERNS_3MatE+0x194): undefined reference to png_set_strip_16'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_png.cpp.o): In functioncv::PngEncoder::writeDataToBuf(void*, unsigned char*, unsigned int)':
grfmt_png.cpp:(.text._ZN2cv10PngEncoder14writeDataToBufEPvPhj+0x16): undefined reference to png_get_io_ptr'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_jpeg.cpp.o): In function_ZN2cvL16my_jpeg_load_dhtEP22jpeg_decompress_structPhPP9JHUFF_TBLS5_.constprop.30':
grfmt_jpeg.cpp:(.text.unlikely._ZN2cvL16my_jpeg_load_dhtEP22jpeg_decompress_structPhPP9JHUFF_TBLS5_.constprop.30+0xa4): undefined reference to jpeg_alloc_huff_table'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_jpeg.cpp.o): In functioncv::JpegEncoder::write(cv::Mat const&, std::vector > const&)':
grfmt_jpeg.cpp:(.text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x6e): undefined reference to jpeg_CreateCompress'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x78): undefined reference tojpeg_std_error'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0xdc): undefined reference to jpeg_destroy_compress'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x194): undefined reference tojpeg_set_defaults'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x1a2): undefined reference to jpeg_set_quality'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x1ae): undefined reference tojpeg_start_compress'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x1f6): undefined reference to jpeg_write_scanlines'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x208): undefined reference tojpeg_finish_compress'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x25e): undefined reference to jpeg_stdio_dest'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x2a6): undefined reference tojpeg_write_scanlines'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegEncoder5writeERKNS_3MatERKSt6vectorIiSaIiEE+0x2fa): undefined reference to jpeg_write_scanlines'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_jpeg.cpp.o): In functioncv::JpegDecoder::close()':
grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder5closeEv+0xa): undefined reference to jpeg_destroy_decompress'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_jpeg.cpp.o): In functioncv::JpegDecoder::readData(cv::Mat&)':
grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder8readDataERNS_3MatE+0x90): undefined reference to jpeg_start_decompress'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder8readDataERNS_3MatE+0x10a): undefined reference tojpeg_read_scanlines'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder8readDataERNS_3MatE+0x15a): undefined reference to jpeg_finish_decompress'
/home/nandhini/opencv/2.4.2static/lib//libopencv_highgui.a(grfmt_jpeg.cpp.o): In functioncv::JpegDecoder::readHeader()':
grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder10readHeaderEv+0x20): undefined reference to jpeg_std_error'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder10readHeaderEv+0x56): undefined reference tojpeg_CreateDecompress'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder10readHeaderEv+0x92): undefined reference to jpeg_stdio_src'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder10readHeaderEv+0x9a): undefined reference tojpeg_read_header'
grfmt_jpeg.cpp:(.text._ZN2cv11JpegDecoder10readHeaderEv+0x13c): undefined reference to jpeg_resync_to_restart'
collect2: ld returned 1 exit status
The order in which libraries are linked matters! This might be the problem.

Eclipse Open CV Application building error?

I am going to build my Open CV project(C++) in Eclipse, but it gives an error in makefile, the error is
recipe for target `Open_CV.exe' failed
i have also included the lib and opencv in project successfuly, but i don't know why i am getting this error, sometimes i am also getting an error in its subdir file
and Error log is :
Build of configuration Debug for project Open_CV **
make all
Building file: ../src/Open_CV.c
Invoking: Cross GCC Compiler
gcc -I"C:\OpenCV2.0\include\opencv" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/Open_CV.d" -MT"src/Open_CV.d" -o"src/Open_CV.o" "../src/Open_CV.c"
In file included from C:/OpenCV2.0/include/opencv/cv.h:1612,
from ../src/Open_CV.c:8:
C:/OpenCV2.0/include/opencv/cvcompat.h: In function cvMinAreaRect':
C:/OpenCV2.0/include/opencv/cvcompat.h:425: warning: left-hand operand of comma expression has no effect
C:/OpenCV2.0/include/opencv/cvcompat.h:425: warning: left-hand operand of comma expression has no effect
C:/OpenCV2.0/include/opencv/cvcompat.h:425: warning: left-hand operand of comma expression has no effect
C:/OpenCV2.0/include/opencv/cvcompat.h:425: warning: statement with no effect
../src/Open_CV.c: In functionmain':
../src/Open_CV.c:20: warning: implicit declaration of function `printf'
../src/Open_CV.c: At top level:
C:/OpenCV2.0/include/opencv/cxtypes.h:249: warning: 'cvFloor' defined but not used
C:/OpenCV2.0/include/opencv/cxtypes.h:267: warning: 'cvCeil' defined but not used
C:/OpenCV2.0/include/opencv/cxtypes.h:287: warning: 'cvIsNaN' defined but not used
C:/OpenCV2.0/include/opencv/cxtypes.h:302: warning: 'cvIsInf' defined but not used
C:/OpenCV2.0/include/opencv/cxtypes.h:321: warning: 'cvRNG' defined but not used
C:/OpenCV2.0/include/opencv/cxtypes.h:337: warning: 'cvRandReal' defined but not used
C:/OpenCV2.0/include/opencv/cxtypes.h:670: warning: 'cvmGet' defined but not used
C:/OpenCV2.0/include/opencv/cxtypes.h:705: warning: 'cvIplDepth' defined but not used
C:/OpenCV2.0/include/opencv/cxtypes.h:880: warning: 'cvRectToROI' defined but not used
C:/OpenCV2.0/include/opencv/cxtypes.h:893: warning: 'cvROIToRect' defined but not used
C:/OpenCV2.0/include/opencv/cxtypes.h:914: warning: 'cvTermCriteria' defined but not used
C:/OpenCV2.0/include/opencv/cxtypes.h:936: warning: 'cvPoint' defined but not used
C:/OpenCV2.0/include/opencv/cxtypes.h:966: warning: 'cvPointTo32f' defined but not used
C:/OpenCV2.0/include/opencv/cxtypes.h:991: warning: 'cvPoint3D32f' defined but not used
C:/OpenCV2.0/include/opencv/cxtypes.h:1011: warning: 'cvPoint2D64f' defined but not used
C:/OpenCV2.0/include/opencv/cxtypes.h:1031: warning: 'cvPoint3D64f' defined but not used
C:/OpenCV2.0/include/opencv/cxtypes.h:1052: warning: 'cvSize' defined but not used
C:/OpenCV2.0/include/opencv/cxtypes.h:1070: warning: 'cvSize2D32f' defined but not used
C:/OpenCV2.0/include/opencv/cxtypes.h:1146: warning: 'cvRealScalar' defined but not used
C:/OpenCV2.0/include/opencv/cxtypes.h:1154: warning: 'cvScalarAll' defined but not used
C:/OpenCV2.0/include/opencv/cxtypes.h:1666: warning: 'cvAttrList' defined but not used
C:/OpenCV2.0/include/opencv/cxcore.h:153: warning: 'cvDecRefData' defined but not used
C:/OpenCV2.0/include/opencv/cxcore.h:174: warning: 'cvIncRefData' defined but not used
C:/OpenCV2.0/include/opencv/cxcore.h:208: warning: 'cvGetRow' defined but not used
C:/OpenCV2.0/include/opencv/cxcore.h:219: warning: 'cvGetCol' defined but not used
C:/OpenCV2.0/include/opencv/cxcore.h:248: warning: 'cvReleaseMatND' defined but not used
C:/OpenCV2.0/include/opencv/cxcore.h:271: warning: 'cvGetNextSparseNode' defined but not used
C:/OpenCV2.0/include/opencv/cxcore.h:522: warning: 'cvSubS' defined but not used
C:/OpenCV2.0/include/opencv/cxcore.h:1083: warning: 'cvCloneSeq' defined but not used
C:/OpenCV2.0/include/opencv/cxcore.h:1126: warning: 'cvSetNew' defined but not used
C:/OpenCV2.0/include/opencv/cxcore.h:1141: warning: 'cvSetRemoveByPtr' defined but not used
C:/OpenCV2.0/include/opencv/cxcore.h:1156: warning: 'cvGetSetElem' defined but not used
C:/OpenCV2.0/include/opencv/cxcore.h:1323: warning: 'cvEllipseBox' defined but not used
C:/OpenCV2.0/include/opencv/cxcore.h:1414: warning: 'cvFont' defined but not used
C:/OpenCV2.0/include/opencv/cxcore.h:1672: warning: 'cvReadIntByName' defined but not used
C:/OpenCV2.0/include/opencv/cxcore.h:1687: warning: 'cvReadRealByName' defined but not used
C:/OpenCV2.0/include/opencv/cxcore.h:1701: warning: 'cvReadStringByName' defined but not used
C:/OpenCV2.0/include/opencv/cxcore.h:1713: warning: 'cvReadByName' defined but not used
C:/OpenCV2.0/include/opencv/cxmisc.h:222: warning: 'cvAlignPtr' defined but not used
C:/OpenCV2.0/include/opencv/cxmisc.h:228: warning: 'cvAlign' defined but not used
C:/OpenCV2.0/include/opencv/cxmisc.h:234: warning: 'cvGetMatSize' defined but not used
C:/OpenCV2.0/include/opencv/cv.h:635: warning: 'cvCreateSubdivDelaunay2D' defined but not used
C:/OpenCV2.0/include/opencv/cv.h:670: warning: 'cvSubdiv2DNextEdge' defined but not used
C:/OpenCV2.0/include/opencv/cv.h:676: warning: 'cvSubdiv2DRotateEdge' defined but not used
C:/OpenCV2.0/include/opencv/cv.h:681: warning: 'cvSubdiv2DSymEdge' defined but not used
C:/OpenCV2.0/include/opencv/cv.h:686: warning: 'cvSubdiv2DGetEdge' defined but not used
C:/OpenCV2.0/include/opencv/cv.h:694: warning: 'cvSubdiv2DEdgeOrg' defined but not used
C:/OpenCV2.0/include/opencv/cv.h:701: warning: 'cvSubdiv2DEdgeDst' defined but not used
C:/OpenCV2.0/include/opencv/cv.h:708: warning: 'cvTriangleArea' defined but not used
C:/OpenCV2.0/include/opencv/cv.h:892: warning: 'cvCalcHist' defined but not used
C:/OpenCV2.0/include/opencv/cv.h:1136: warning: 'cvSURFPoint' defined but not used
C:/OpenCV2.0/include/opencv/cv.h:1207: warning: 'cvStarKeypoint' defined but not used
C:/OpenCV2.0/include/opencv/cv.h:1231: warning: 'cvStarDetectorParams' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:112: warning: 'cvMatArray' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:127: warning: 'cvMean' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:134: warning: 'cvSumPixels' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:141: warning: 'cvMean_StdDev' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:154: warning: 'cvmPerspectiveProject' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:165: warning: 'cvFillImage' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:216: warning: 'cvRandInit' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:249: warning: 'cvbRand' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:257: warning: 'cvbCartToPolar' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:273: warning: 'cvbFastArctan' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:286: warning: 'cvbSqrt' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:296: warning: 'cvbInvSqrt' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:306: warning: 'cvbReciprocal' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:316: warning: 'cvbFastExp' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:324: warning: 'cvbFastLog' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:332: warning: 'cvContourBoundingRect' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:338: warning: 'cvPseudoInverse' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:385: warning: 'cvConvexHull' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:413: warning: 'cvMinAreaRect' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:434: warning: 'cvFitLine3D' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:444: warning: 'cvFitLine2D' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:453: warning: 'cvFitEllipse' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:464: warning: 'cvProject3D' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:506: warning: 'cvHoughLines' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:519: warning: 'cvHoughLinesP' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:531: warning: 'cvHoughLinesSDiv' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:543: warning: 'cvFindFundamentalMatrix' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:577: warning: 'cvFindChessBoardCornerGuesses' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:588: warning: 'cvCalibrateCamera' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:613: warning: 'cvCalibrateCamera_64d' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:642: warning: 'cvFindExtrinsicCameraParams' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:667: warning: 'cvFindExtrinsicCameraParams_64d' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:693: warning: 'cvRodrigues' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:711: warning: 'cvProjectPoints' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:740: warning: 'cvProjectPointsSimple' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:771: warning: 'cvUnDistortInit' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:786: warning: 'cvUnDistort' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:804: warning: 'cvCalcEMD' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:815: warning: 'cvKMeans' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:829: warning: 'cvStartScanGraph' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:842: warning: 'cvEndScanGraph' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:862: warning: 'cvLineAA' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:868: warning: 'cvCircleAA' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:876: warning: 'cvEllipseAA' defined but not used
C:/OpenCV2.0/include/opencv/cvcompat.h:883: warning: 'cvPolyLineAA' defined but not used
Finished building: ../src/Open_CV.c
Building target: Open_CV.exe
Invoking: Cross GCC Linker
gcc -L"C:\OpenCV2.0\lib" -o"Open_CV.exe" ./src/Open_CV.o -lcv200 -lhighgui200
./src/Open_CV.o: In function cvDecRefData':
C:/OpenCV2.0/include/opencv/cxcore.h:159: undefined reference tocvFree'
C:/OpenCV2.0/include/opencv/cxcore.h:167: undefined reference to _cvFree_'
./src/Open_CV.o: In functioncvGetRow':
C:/OpenCV2.0/include/opencv/cxcore.h:209: undefined reference to _cvGetRows'
./src/Open_CV.o: In functioncvGetCol':
C:/OpenCV2.0/include/opencv/cxcore.h:220: undefined reference to _cvGetCols'
./src/Open_CV.o: In functioncvReleaseMatND':
C:/OpenCV2.0/include/opencv/cxcore.h:249: undefined reference to _cvReleaseMat'
./src/Open_CV.o: In functioncvSubS':
C:/OpenCV2.0/include/opencv/cxcore.h:523: undefined reference to _cvAddS'
./src/Open_CV.o: In functioncvCloneSeq':
C:/OpenCV2.0/include/opencv/cxcore.h:1084: undefined reference to _cvSeqSlice'
./src/Open_CV.o: In functioncvSetNew':
C:/OpenCV2.0/include/opencv/cxcore.h:1135: undefined reference to _cvSetAdd'
./src/Open_CV.o: In functioncvGetSetElem':
C:/OpenCV2.0/include/opencv/cxcore.h:1157: undefined reference to _cvGetSeqElem'
./src/Open_CV.o: In functioncvEllipseBox':
C:/OpenCV2.0/include/opencv/cxcore.h:1328: undefined reference to _cvEllipse'
./src/Open_CV.o: In functioncvFont':
C:/OpenCV2.0/include/opencv/cxcore.h:1416: undefined reference to _cvInitFont'
./src/Open_CV.o: In functioncvReadIntByName':
C:/OpenCV2.0/include/opencv/cxcore.h:1673: undefined reference to _cvGetFileNodeByName'
./src/Open_CV.o: In functioncvReadRealByName':
C:/OpenCV2.0/include/opencv/cxcore.h:1688: undefined reference to _cvGetFileNodeByName'
./src/Open_CV.o: In functioncvReadStringByName':
C:/OpenCV2.0/include/opencv/cxcore.h:1702: undefined reference to _cvGetFileNodeByName'
./src/Open_CV.o: In functioncvReadByName':
C:/OpenCV2.0/include/opencv/cxcore.h:1714: undefined reference to _cvGetFileNodeByName'
C:/OpenCV2.0/include/opencv/cxcore.h:1714: undefined reference to_cvRead'
./src/Open_CV.o: In function cvMean':
C:/OpenCV2.0/include/opencv/cvcompat.h:128: undefined reference to_cvAvg'
./src/Open_CV.o: In function cvSumPixels':
C:/OpenCV2.0/include/opencv/cvcompat.h:135: undefined reference to_cvSum'
./src/Open_CV.o: In function cvMean_StdDev':
C:/OpenCV2.0/include/opencv/cvcompat.h:143: undefined reference to_cvAvgSdv'
./src/Open_CV.o: In function cvmPerspectiveProject':
C:/OpenCV2.0/include/opencv/cvcompat.h:157: undefined reference to_cvReshape'
C:/OpenCV2.0/include/opencv/cvcompat.h:158: undefined reference to _cvReshape'
C:/OpenCV2.0/include/opencv/cvcompat.h:160: undefined reference to_cvPerspectiveTransform'
./src/Open_CV.o: In function cvFillImage':
C:/OpenCV2.0/include/opencv/cvcompat.h:166: undefined reference to_cvGetElemType'
C:/OpenCV2.0/include/opencv/cvcompat.h:166: undefined reference to _cvColorToScalar'
C:/OpenCV2.0/include/opencv/cvcompat.h:166: undefined reference to_cvSet'
./src/Open_CV.o: In function cvRandSetRange':
C:/OpenCV2.0/include/opencv/cvcompat.h:188: undefined reference to_cvError'
C:/OpenCV2.0/include/opencv/cvcompat.h:194: undefined reference to _cvError'
./src/Open_CV.o: In functioncvRandInit':
C:/OpenCV2.0/include/opencv/cvcompat.h:219: undefined reference to _cvError'
C:/OpenCV2.0/include/opencv/cvcompat.h:225: undefined reference to_cvError'
./src/Open_CV.o: In function cvRand':
C:/OpenCV2.0/include/opencv/cvcompat.h:240: undefined reference to_cvError'
C:/OpenCV2.0/include/opencv/cvcompat.h:243: undefined reference to _cvRandArr'
./src/Open_CV.o: In functioncvbCartToPolar':
C:/OpenCV2.0/include/opencv/cvcompat.h:267: undefined reference to _cvCartToPolar'
./src/Open_CV.o: In functioncvbFastArctan':
C:/OpenCV2.0/include/opencv/cvcompat.h:281: undefined reference to _cvCartToPolar'
./src/Open_CV.o: In functioncvbSqrt':
C:/OpenCV2.0/include/opencv/cvcompat.h:291: undefined reference to _cvPow'
./src/Open_CV.o: In functioncvbInvSqrt':
C:/OpenCV2.0/include/opencv/cvcompat.h:301: undefined reference to _cvPow'
./src/Open_CV.o: In functioncvbReciprocal':
C:/OpenCV2.0/include/opencv/cvcompat.h:311: undefined reference to _cvPow'
./src/Open_CV.o: In functioncvbFastExp':
C:/OpenCV2.0/include/opencv/cvcompat.h:319: undefined reference to _cvExp'
./src/Open_CV.o: In functioncvbFastLog':
C:/OpenCV2.0/include/opencv/cvcompat.h:327: undefined reference to _cvLog'
./src/Open_CV.o: In functioncvPseudoInverse':
C:/OpenCV2.0/include/opencv/cvcompat.h:339: undefined reference to _cvInvert'
./src/Open_CV.o: In functioncvProject3D':
C:/OpenCV2.0/include/opencv/cvcompat.h:473: undefined reference to _cvTransform'
./src/Open_CV.o: In functioncvFindFundamentalMatrix':
C:/OpenCV2.0/include/opencv/cvcompat.h:549: undefined reference to _cvCreateMat'
C:/OpenCV2.0/include/opencv/cvcompat.h:550: undefined reference to_cvCreateMat'
C:/OpenCV2.0/include/opencv/cvcompat.h:566: undefined reference to _cvReleaseMat'
C:/OpenCV2.0/include/opencv/cvcompat.h:567: undefined reference to_cvReleaseMat'
./src/Open_CV.o: In function cvUnDistortInit':
C:/OpenCV2.0/include/opencv/cvcompat.h:774: undefined reference to_cvGetRawData'
./src/Open_CV.o: In function cvUnDistort':
C:/OpenCV2.0/include/opencv/cvcompat.h:790: undefined reference to_cvGetRawData'
./src/Open_CV.o: In function cvKMeans':
C:/OpenCV2.0/include/opencv/cvcompat.h:816: undefined reference to_cvCreateMat'
C:/OpenCV2.0/include/opencv/cvcompat.h:821: undefined reference to _cvKMeans2'
C:/OpenCV2.0/include/opencv/cvcompat.h:822: undefined reference to_cvReleaseMat'
./src/Open_CV.o: In function cvStartScanGraph':
C:/OpenCV2.0/include/opencv/cvcompat.h:833: undefined reference to_cvError'
C:/OpenCV2.0/include/opencv/cvcompat.h:835: undefined reference to _cvCreateGraphScanner'
C:/OpenCV2.0/include/opencv/cvcompat.h:837: undefined reference tocvFree'
./src/Open_CV.o: In function cvEndScanGraph':
C:/OpenCV2.0/include/opencv/cvcompat.h:844: undefined reference to_cvError'
C:/OpenCV2.0/include/opencv/cvcompat.h:848: undefined reference to _cvAlloc'
C:/OpenCV2.0/include/opencv/cvcompat.h:850: undefined reference to_cvReleaseGraphScanner'
./src/Open_CV.o: In function cvLineAA':
C:/OpenCV2.0/include/opencv/cvcompat.h:863: undefined reference to_cvGetElemType'
C:/OpenCV2.0/include/opencv/cvcompat.h:863: undefined reference to _cvColorToScalar'
C:/OpenCV2.0/include/opencv/cvcompat.h:863: undefined reference to_cvLine'
./src/Open_CV.o: In function cvCircleAA':
C:/OpenCV2.0/include/opencv/cvcompat.h:869: undefined reference to_cvGetElemType'
C:/OpenCV2.0/include/opencv/cvcompat.h:869: undefined reference to _cvColorToScalar'
C:/OpenCV2.0/include/opencv/cvcompat.h:869: undefined reference to_cvCircle'
./src/Open_CV.o: In function cvEllipseAA':
C:/OpenCV2.0/include/opencv/cvcompat.h:877: undefined reference to_cvGetElemType'
C:/OpenCV2.0/include/opencv/cvcompat.h:877: undefined reference to _cvColorToScalar'
C:/OpenCV2.0/include/opencv/cvcompat.h:877: undefined reference to_cvEllipse'
makefile:30: recipe for target Open_CV.exe' failed
./src/Open_CV.o: In functioncvPolyLineAA':
C:/OpenCV2.0/include/opencv/cvcompat.h:884: undefined reference to _cvGetElemType'
C:/OpenCV2.0/include/opencv/cvcompat.h:884: undefined reference to_cvColorToScalar'
C:/OpenCV2.0/include/opencv/cvcompat.h:884: undefined reference to `_cvPolyLine'
collect2: ld returned 1 exit status
make: * [Open_CV.exe] Error 1
I think you missed to link the libcxcore "-lcxcore" (or maybe "-lcvaux").

Using Opencv as a static lib on a cross-compiling project

I'm using opencv on a arm board,with a cortex a8 processor and running on Debian.I wanted to use the processor's fpu to increase the performance of my application,so I succesfully cross-compiled opencv (following this guide) using a toolchain generated for this purpose.
With that said,I dont have experience with working with static libraries.When I compile my code,I get a lot of linking errors.Apparently,they are related with zlib or zlib2,as I've seen on this topic.The thing is,I didn't enabled the png support,but I still get those linking errors:
cxpersistence.cpp:(.text._ZL8icvCloseP13CvFileStorage+0x24): undefined reference to `gzclose'
/cv-lib-arm-hf/lib/libcxcore.a(cxpersistence.o): In function `icvPuts(CvFileStorage*, char const*)':
cxpersistence.cpp:(.text._ZL7icvPutsP13CvFileStoragePKc+0x3c): undefined reference to `gzputs'
/cv-lib-arm-hf/lib/libcxcore.a(cxpersistence.o): In function `icvGets(CvFileStorage*, char*, int)':
cxpersistence.cpp:(.text._ZL7icvGetsP13CvFileStoragePci+0x4c): undefined reference to `gzgets'
/cv-lib-arm-hf/lib/libcxcore.a(cxpersistence.o): In function `icvEof(CvFileStorage*)':
cxpersistence.cpp:(.text._ZL6icvEofP13CvFileStorage+0x30): undefined reference to `gzeof'
cxpersistence.cpp:(.text._ZL6icvEofP13CvFileStorage+0xc4): undefined reference to `gzeof'
/cv-lib-arm-hf/lib/libcxcore.a(cxpersistence.o): In function `cvOpenFileStorage':
cxpersistence.cpp:(.text.cvOpenFileStorage+0x674): undefined reference to `gzopen'
cxpersistence.cpp:(.text.cvOpenFileStorage+0xae8): undefined reference to `gzrewind'
cxpersistence.cpp:(.text.cvOpenFileStorage+0xb98): undefined reference to `gzrewind'
/cv-lib-arm-hf/lib/libcxcore.a(cxlapack.o): In function `cv::SVD::operator()(cv::Mat const&, int)':
cxlapack.cpp:(.text._ZN2cv3SVDclERKNS_3MatEi+0x2b0): undefined reference to `dgesdd_'
cxlapack.cpp:(.text._ZN2cv3SVDclERKNS_3MatEi+0x4b8): undefined reference to `dgesdd_'
cxlapack.cpp:(.text._ZN2cv3SVDclERKNS_3MatEi+0x74c): undefined reference to `sgesdd_'
cxlapack.cpp:(.text._ZN2cv3SVDclERKNS_3MatEi+0x874): undefined reference to `sgesdd_'
/cv-lib-arm-hf/lib/libcxcore.a(cxlapack.o): In function `cv::eigen(cv::Mat const&, cv::Mat&, cv::Mat&, bool, int, int)':
cxlapack.cpp:(.text._ZN2cvL5eigenERKNS_3MatERS0_S3_bii+0x4bc): undefined reference to `dsyevr_'
cxlapack.cpp:(.text._ZN2cvL5eigenERKNS_3MatERS0_S3_bii+0x66c): undefined reference to `dsyevr_'
cxlapack.cpp:(.text._ZN2cvL5eigenERKNS_3MatERS0_S3_bii+0xa7c): undefined reference to `ssyevr_'
cxlapack.cpp:(.text._ZN2cvL5eigenERKNS_3MatERS0_S3_bii+0xc30): undefined reference to `ssyevr_'
/cv-lib-arm-hf/lib/libcxcore.a(cxlapack.o): In function `cv::solve(cv::Mat const&, cv::Mat const&, cv::Mat&, int)':
cxlapack.cpp:(.text._ZN2cv5solveERKNS_3MatES2_RS0_i+0x760): undefined reference to `dgelsd_'
cxlapack.cpp:(.text._ZN2cv5solveERKNS_3MatES2_RS0_i+0x8fc): undefined reference to `dgelsd_'
cxlapack.cpp:(.text._ZN2cv5solveERKNS_3MatES2_RS0_i+0xb8c): undefined reference to `dgesv_'
cxlapack.cpp:(.text._ZN2cv5solveERKNS_3MatES2_RS0_i+0x1018): undefined reference to `dpotrf_'
cxlapack.cpp:(.text._ZN2cv5solveERKNS_3MatES2_RS0_i+0x105c): undefined reference to `dpotrs_'
cxlapack.cpp:(.text._ZN2cv5solveERKNS_3MatES2_RS0_i+0x10d4): undefined reference to `dgels_'
cxlapack.cpp:(.text._ZN2cv5solveERKNS_3MatES2_RS0_i+0x115c): undefined reference to `dgels_'
cxlapack.cpp:(.text._ZN2cv5solveERKNS_3MatES2_RS0_i+0x11e0): undefined reference to `sgelsd_'
cxlapack.cpp:(.text._ZN2cv5solveERKNS_3MatES2_RS0_i+0x123c): undefined reference to `sgelsd_'
cxlapack.cpp:(.text._ZN2cv5solveERKNS_3MatES2_RS0_i+0x12e0): undefined reference to `spotrf_'
cxlapack.cpp:(.text._ZN2cv5solveERKNS_3MatES2_RS0_i+0x1324): undefined reference to `spotrs_'
cxlapack.cpp:(.text._ZN2cv5solveERKNS_3MatES2_RS0_i+0x1398): undefined reference to `sgels_'
cxlapack.cpp:(.text._ZN2cv5solveERKNS_3MatES2_RS0_i+0x13e8): undefined reference to `sgels_'
cxlapack.cpp:(.text._ZN2cv5solveERKNS_3MatES2_RS0_i+0x1468): undefined reference to `sgesv_'
/cv-lib-arm-hf/lib/libcxcore.a(cxlapack.o): In function `cv::determinant(cv::Mat const&)':
cxlapack.cpp:(.text._ZN2cv11determinantERKNS_3MatE+0x298): undefined reference to `dgetrf_'
cxlapack.cpp:(.text._ZN2cv11determinantERKNS_3MatE+0x40c): undefined reference to `sgetrf_'
/cv-lib-arm-hf/lib/libcxcore.a(cxlapack.o): In function `cv::invert(cv::Mat const&, cv::Mat&, int)':
cxlapack.cpp:(.text._ZN2cv6invertERKNS_3MatERS0_i+0x460): undefined reference to `dgetri_'
cxlapack.cpp:(.text._ZN2cv6invertERKNS_3MatERS0_i+0x4c8): undefined reference to `dgetrf_'
cxlapack.cpp:(.text._ZN2cv6invertERKNS_3MatERS0_i+0x7e4): undefined reference to `dpotrf_'
cxlapack.cpp:(.text._ZN2cv6invertERKNS_3MatERS0_i+0x82c): undefined reference to `sgetri_'
cxlapack.cpp:(.text._ZN2cv6invertERKNS_3MatERS0_i+0xa78): undefined reference to `sgetrf_'
cxlapack.cpp:(.text._ZN2cv6invertERKNS_3MatERS0_i+0xab0): undefined reference to `sgetri_'
cxlapack.cpp:(.text._ZN2cv6invertERKNS_3MatERS0_i+0xaf8): undefined reference to `dgetri_'
cxlapack.cpp:(.text._ZN2cv6invertERKNS_3MatERS0_i+0xb28): undefined reference to `spotrf_'
cxlapack.cpp:(.text._ZN2cv6invertERKNS_3MatERS0_i+0xb5c): undefined reference to `spotri_'
cxlapack.cpp:(.text._ZN2cv6invertERKNS_3MatERS0_i+0xb84): undefined reference to `dpotri_'
Can anyone shed a light on what I need to do?What am I missing?
UPDATE:
I tried compiling zlib and bzip2 using the same toolchain,but the error persists.Now I have no idea of what I'm doing wrong.Can anyone help?

Compile OpenCV sample convert_cascade.cpp (OpenCV 2.3)

I'm running OpenCV 2.3.1 on Ubuntu 11.10. I can compile various program I've written myself wih no issue.
Now, however, I have a half-done Haar cascade, that I need to assemble into the xml-cascade file. For this purpose I need to use the included sample program convert_cascade.c. It is not compiled by default, so I need to do that.
Running gcc like this fails:
gcc -lopencv_core -lopencv_highgui -lopencv_objdetect -I/usr/local/include/opencv/ -L/usr/local/lib/ convert_cascade.c -o convert_cascade
It gives me the following errors:
/tmp/cc5UddX6.o: In function `cvRound':
convert_cascade.c:(.text+0x19): undefined reference to `lrint'
/tmp/cc5UddX6.o: In function `cvDecRefData':
convert_cascade.c:(.text+0xb3b): undefined reference to `cvFree_'
convert_cascade.c:(.text+0xbac): undefined reference to `cvFree_'
/tmp/cc5UddX6.o: In function `cvGetRow':
convert_cascade.c:(.text+0xca2): undefined reference to `cvGetRows'
/tmp/cc5UddX6.o: In function `cvGetCol':
convert_cascade.c:(.text+0xccd): undefined reference to `cvGetCols'
/tmp/cc5UddX6.o: In function `cvReleaseMatND':
convert_cascade.c:(.text+0xce0): undefined reference to `cvReleaseMat'
/tmp/cc5UddX6.o: In function `cvSubS':
convert_cascade.c:(.text+0xe00): undefined reference to `cvAddS'
/tmp/cc5UddX6.o: In function `cvCloneSeq':
convert_cascade.c:(.text+0xe4e): undefined reference to `cvSeqSlice'
/tmp/cc5UddX6.o: In function `cvSetNew':
convert_cascade.c:(.text+0xead): undefined reference to `cvSetAdd'
/tmp/cc5UddX6.o: In function `cvGetSetElem':
convert_cascade.c:(.text+0xf40): undefined reference to `cvGetSeqElem'
/tmp/cc5UddX6.o: In function `cvEllipseBox':
convert_cascade.c:(.text+0x1040): undefined reference to `cvEllipse'
/tmp/cc5UddX6.o: In function `cvFont':
convert_cascade.c:(.text+0x1090): undefined reference to `cvInitFont'
/tmp/cc5UddX6.o: In function `cvReadIntByName':
convert_cascade.c:(.text+0x111e): undefined reference to `cvGetFileNodeByName'
/tmp/cc5UddX6.o: In function `cvReadRealByName':
convert_cascade.c:(.text+0x11af): undefined reference to `cvGetFileNodeByName'
/tmp/cc5UddX6.o: In function `cvReadStringByName':
convert_cascade.c:(.text+0x1209): undefined reference to `cvGetFileNodeByName'
/tmp/cc5UddX6.o: In function `cvReadByName':
convert_cascade.c:(.text+0x1239): undefined reference to `cvGetFileNodeByName'
convert_cascade.c:(.text+0x124f): undefined reference to `cvRead'
/tmp/cc5UddX6.o: In function `main':
convert_cascade.c:(.text+0x13b6): undefined reference to `cvLoadHaarClassifierCascade'
convert_cascade.c:(.text+0x1495): undefined reference to `cvSave'
collect2: ld returned 1 exit status
It seems that all the missing functions areare old C-style OpenCV functions prototyped in core_c.h. But including that ( #include <opencv2/core/core_c.h> ) makes no difference. I also tried compiling with the -lopencv_legacy flag (basically just a guess that it might have something to do with older functions), to no avail.
What should I do in order to compile it?
There should be a build_all.sh script in the /samples/c/ directory that will build all the examples for you; no CMAKE tweaks required.
Nevermind. It turned out I had to recompile OpenCV anyway in order to enable TBB, so I simply gave CMAKE the BUILD_EXAMPLES=ON command, and now I have it in a compiled version. I'm pretty sure that is not the proper solution though ;-)

Resources