untrunc icon indicating copy to clipboard operation
untrunc copied to clipboard

Compilation error: undefined symbols

Open aaronhedquist opened this issue 6 years ago • 1 comments

I'm building on a Mac running 10.14.2. Was able to fix the endian.h errors thanks to the previous post, but now I'm stuck here:

Undefined symbols for architecture x86_64:
  "_av_dump_format", referenced from:
      Mp4::open(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in mp4-8474e2.o
  "_av_init_packet", referenced from:
      Codec::getLength(unsigned char*, int, int&) in track-b7a045.o
  "_av_register_all", referenced from:
      Mp4::open(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in mp4-8474e2.o
  "_avcodec_decode_audio4", referenced from:
      Codec::getLength(unsigned char*, int, int&) in track-b7a045.o
  "_avcodec_find_decoder", referenced from:
      Track::parse(Atom*, Atom*) in track-b7a045.o
  "_avcodec_open2", referenced from:
      Track::parse(Atom*, Atom*) in track-b7a045.o
  "_avformat_alloc_context", referenced from:
      Mp4::open(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in mp4-8474e2.o
  "_avformat_find_stream_info", referenced from:
      Mp4::open(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in mp4-8474e2.o
  "_avformat_open_input", referenced from:
      Mp4::open(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) in mp4-8474e2.o
ld: symbol(s) not found for architecture x86_64

I see both the header and source files that related to the undefined symbols, I'm not clear on what is missing. I'm using this command to compile:

g++ -o untrunc -I./libav-12.3 file.cpp main.cpp track.cpp atom.cpp mp4.cpp -L./libav-12.3/libavformat -L./libav-12.3/libavcodec -L./libav-12.3/libavresample -lavresample -L./libav-12.3/libavutil -lavutil -lpthread -lz -framework CoreFoundation -framework CoreVideo -framework VideoDecodeAcceleration

Any help would be appreciated!

aaronhedquist avatar Dec 31 '18 19:12 aaronhedquist

Had exactly same issue. Adding -lbz2 as g++ parameters have solved it. So the command looks like:

g++ -o untrunc -I./libav-12.3 file.cpp main.cpp track.cpp atom.cpp mp4.cpp -L./libav-12.3/libavformat -lavformat -L./libav-12.3/libavcodec -lavcodec -L./libav-12.3/libavresample -lavresample -L./libav-12.3/libavutil -lavutil -lpthread -lz -framework CoreFoundation -framework CoreVideo -framework VideoDecodeAcceleration -lbz2

descapist avatar Jan 15 '19 16:01 descapist