I am trying to compile a c program for windows and ubuntu to do that i am using mingw but it seems that it cant find the required libraries that gcc can find when i execute this command
gcc decode_video.c -o dv -lavcodec -lavutil Everything compiles normally but when i use this
x86_64-w64-mingw32-gcc decode_video.c -o dv.exe -lavcodec -lavutil it says that header files arent found
after changing the build command to
x86_64-w64-mingw32-gcc decode_video.c -o dv.exe -I /usr/include/x86_64-linux-gnu -L /usr/lib/x86_64-linux-gnu -l avcodec -l avutil it know gives me this error even though the libraries are linked
/tmp/ccgn1NTi.o:decode_video.c:(.text+0x138): undefined reference to `avcodec_send_packet' /tmp/ccgn1NTi.o:decode_video.c:(.text+0x192): undefined reference to avcodec_receive_frame' /tmp/ccgn1NTi.o:decode_video.c:(.text+0x33f): undefined reference toav_packet_alloc' /tmp/ccgn1NTi.o:decode_video.c:(.text+0x37d): undefined reference to avcodec_find_decoder' /tmp/ccgn1NTi.o:decode_video.c:(.text+0x3d0): undefined reference toav_parser_init' /tmp/ccgn1NTi.o:decode_video.c:(.text+0x421): undefined reference to avcodec_alloc_context3' /tmp/ccgn1NTi.o:decode_video.c:(.text+0x481): undefined reference toavcodec_open2' /tmp/ccgn1NTi.o:decode_video.c:(.text+0x512): undefined reference to av_frame_alloc' /tmp/ccgn1NTi.o:decode_video.c:(.text+0x5fc): undefined reference toav_parser_parse2' /tmp/ccgn1NTi.o:decode_video.c:(.text+0x6f8): undefined reference to av_parser_close' /tmp/ccgn1NTi.o:decode_video.c:(.text+0x707): undefined reference toavcodec_free_context' /tmp/ccgn1NTi.o:decode_video.c:(.text+0x716): undefined reference to av_frame_free' /tmp/ccgn1NTi.o:decode_video.c:(.text+0x722): undefined reference toav_packet_free' collect2: error: ld returned 1 exit status