Hello / good evening, recently I looked into the development of hombrew application for switch. I wanted to start very simply so I tried to display a video with FFmpg + SDL2. But when compiling I get this:
I think it comes from the make file, by the way if you need it, here it is:
I didn't give the whole makefile because I think the rest is useless.
Does anyone know about it and can explain to me why the references are indefinite ?
Thanks in advance for your reply.
Code:
linking Rickroll2000.elf
C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.o: in function `main':
main.cpp:(.text.startup.main+0xf8): undefined reference to `av_register_all()'
C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x118): undefined reference to `avformat_open_input(AVFormatContext**, char const*, AVInputFormat*, AVDictionary**)'
C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x128): undefined reference to `avformat_find_stream_info(AVFormatContext*, AVDictionary**)'
C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x17c): undefined reference to `avcodec_find_decoder(AVCodecID)'
C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x184): undefined reference to `avcodec_alloc_context3(AVCodec const*)'
C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x190): undefined reference to `avcodec_parameters_to_context(AVCodecContext*, AVCodecParameters const*)'
C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x1a4): undefined reference to `avcodec_open2(AVCodecContext*, AVCodec const*, AVDictionary**)'
C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x1fc): undefined reference to `av_frame_alloc()'
C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x204): undefined reference to `av_packet_alloc()'
C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x214): undefined reference to `av_packet_unref(AVPacket*)'
C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x220): undefined reference to `av_read_frame(AVFormatContext*, AVPacket*)'
C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x240): undefined reference to `avcodec_send_packet(AVCodecContext*, AVPacket const*)'
C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x24c): undefined reference to `avcodec_receive_frame(AVCodecContext*, AVFrame*)'
C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x2a8): undefined reference to `av_frame_free(AVFrame**)'
C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x2b0): undefined reference to `av_packet_free(AVPacket**)'
C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x2bc): undefined reference to `avcodec_close(AVCodecContext*)'
C:/devkitPro/devkitA64/bin/../lib/gcc/aarch64-none-elf/13.1.0/../../../../aarch64-none-elf/bin/ld.exe: main.cpp:(.text.startup.main+0x2c4): undefined reference to `avformat_close_input(AVFormatContext**)'
collect2.exe: error: ld returned 1 exit status
make[1]: *** [/opt/devkitpro/libnx/switch_rules:81: /home/mpopc/Desktop/Rickroll2000/Rickroll2000.elf] Error 1
make: *** [Makefile:160: build] Error 2
I think it comes from the make file, by the way if you need it, here it is:
Makefile:
ARCH := -march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIE
CFLAGS := `$(PREFIX)pkg-config --cflags sdl2 SDL2_mixer SDL2_image` -Wall -O2 -ffunction-sections \
$(ARCH) $(DEFINES)
CFLAGS += $(INCLUDE) -D__SWITCH__
CXXFLAGS := $(CFLAGS) -std=c++14
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
LIBS := `$(PREFIX)pkg-config --libs sdl2 SDL2_mixer SDL2_image SDL2_ttf` \
-lavformat -lavcodec -lswresample -lswscale -lavutil -lbz2 -lass -ltheora -lvorbis -logg -lz -lnx
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(PORTLIBS) $(LIBNX)
I didn't give the whole makefile because I think the rest is useless.
Does anyone know about it and can explain to me why the references are indefinite ?
Thanks in advance for your reply.