0

Setting up ffmpeg shared libraries that are downloaded from ffmpeg zenaroe (https://ffmpeg.zeranoe.com/builds/) for windows_64bit. The IDE is VS2013.

I downloaded dev and shared build for windows 64bit.

And followed steps like bellow but when building, linker error happens. The object file is created so compiling seems done. But there seems to be a problem finding referenced functions at the linking stage.

  1. Create win32 project and main.cpp
  2. Copy ffmpeg_dev's include and lib folders to solution directory.
  3. Open project properties and add the include dir and the lib dir.
  4. Add lib names to linker input.
  5. Build

    main.cpp

    extern "C"{
    #include <libavformat\avformat.h>
    }
    int main(void){
    
        av_register_all();
    
        return 0;
    }
    

The linker error is:

LNK2019 unresloved external symbol _av_register_all referenced in function _main.

valiano
  • 16,433
  • 7
  • 64
  • 79
Hyun Jung
  • 69
  • 2
  • 10
  • 2
    Don't forget to link in any and all libraries necessary to use FFMPEG properly. – tadman Dec 19 '17 at 06:04
  • I didn't forget it. I would not have asked this question If I had forgotten. thanks anyways – Hyun Jung Dec 19 '17 at 06:14
  • 1
    You've forgotten something or you wouldn't be getting linker errors about unresolved symbols. I'm just reading what you've posted. Maybe you think you've linked in the right libraries but you're linking in something else by mistake, or the linker isn't looking in the right places. – tadman Dec 19 '17 at 06:15
  • What I did for the linker was to add library names to linker property. – Hyun Jung Dec 19 '17 at 06:17
  • 1
    Whatever you've done your linker isn't happy yet. Is the `extern "C"` stuff necessary? That seems unusual and could be the source of these problems. – tadman Dec 19 '17 at 06:19
  • extern "C" is very necessary here since ffmpeg libraries are written in C. – Hyun Jung Dec 19 '17 at 06:21
  • That might be the case, but C++ usually knows what's what and can figure it out on its own. That forces C naming conventions and symbols, which might mess up your linking. – tadman Dec 19 '17 at 06:22
  • I did every stuff on https://stackoverflow.com/questions/7845886/linking-dll-in-visual-studio. but it's not working. – Hyun Jung Dec 19 '17 at 06:24
  • Did you get rid of the `extern "C"` thing yet? I use C libraries all the time in C++ and I've never had to do that. If the library cares, it'll declare that in its own header files. It shouldn't be your job. – tadman Dec 19 '17 at 06:24
  • Even though I deleted extern c{}, it still comes with a same error. – Hyun Jung Dec 19 '17 at 06:28
  • It's worth seeing if that symbol is properly defined in your compiled libraries at all. Does this problem persist if you have `main.c` instead of `main.cpp`? – tadman Dec 19 '17 at 06:29
  • still producing same errors with main.c – Hyun Jung Dec 19 '17 at 06:33
  • I think your build is broken because that function should be defined, it's documented in the FFMPEG API, but that's just my take. I can't see exactly what's going on here. – tadman Dec 19 '17 at 06:36
  • 1
    it was a really stupid mistake. I had to change the platform from win32 to x64. – Hyun Jung Dec 19 '17 at 08:57
  • Ah, trying to link 64-bit binaries into a 32-bit project. – tadman Dec 19 '17 at 17:05

0 Answers0