简体   繁体   中英

ffmpeg in C++ “av_register_all not declared in this scope”

I'm trying to compile this simple program in C++ (in Code Blocks):

#ifdef __cplusplus
extern "C" {
    #endif
    #include <libavutil/avutil.h>
    #include <libavcodec/avcodec.h>
#ifdef __cplusplus
};
#endif

int main(int argc, char *argv[]) {
    av_register_all();
    return 0;
}

However I keep getting the error message: |11|error: 'av_register_all' was not declared in this scope|

Other people seem to have had this problem and adding the extern "C" section seems to have solved it form them but not me. Does anyone have any suggestions?

Thanks

Did you set up your additional libraries / additional include files? Here you can find how to do it in MSVC++, I have used CodeBlocks a little & never included an external library to it, however I think you should be able to adopt it to CodeBlocks.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM