D
Deleted User
Guest
OP
Hey
I want to develop Homebrew games but what is a game without graphics.
correct... not very much.
so i tried installing SDL2 and that happens when i compile a image renderer
my sample picture is this: (painted it myself. no copyright.)
the code is from this example github page : https://gist.githubusercontent.com/...a7ffdf0312f728a3e26bee369d5ef7be48/openicon.c
this gave me this error:
It gaves me a Makefile error so i thought i need to add a libary.
i added this line to the Makefile and overwrote the old one:
But i got even more errors:
thats my makefile:
its based on the Sdl2-simple example from devkitpro.
and yes i installed the SDL2 Libary with MSYS2
sorry for many code spoilers.
guess its something with the makefile and im not very good when people talk about makefiles. hope some can help me.
BTW the main file name's main.cpp
the makefile name's Makefile
and the romfs is correct
so that was my long thread and i asking for an fix now how to render a image.
btw yes the file names cpp but i really dont want to make CPP programs im C programmer.
but when i rename the Program back to .c then i get these errors.
https://pastebin.com/raw/NeVjuRct warning its very long
so after obtaining the longest thread on earth medal i hope now for getting help
I want to develop Homebrew games but what is a game without graphics.
correct... not very much.
so i tried installing SDL2 and that happens when i compile a image renderer
my sample picture is this: (painted it myself. no copyright.)
the code is from this example github page : https://gist.githubusercontent.com/...a7ffdf0312f728a3e26bee369d5ef7be48/openicon.c
Code:
#include <stdio.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#define WIDTH 800
#define HEIGHT 600
#define IMG_PATH "exit.png" <--- this got edited and the 800x600 pixels are correct: now there is a: romfs:/image.png
int main (int argc, char *argv[]) {
// variable declarations
SDL_Window *win = NULL;
SDL_Renderer *renderer = NULL;
SDL_Texture *img = NULL;
int w, h; // texture width & height
// Initialize SDL.
if (SDL_Init(SDL_INIT_VIDEO) < 0)
return 1;
// create the window and renderer
// note that the renderer is accelerated
win = SDL_CreateWindow("Image Loading", 100, 100, WIDTH, HEIGHT, 0);
renderer = SDL_CreateRenderer(win, -1, SDL_RENDERER_ACCELERATED);
// load our image
img = IMG_LoadTexture(renderer, IMG_PATH);
SDL_QueryTexture(img, NULL, NULL, &w, &h); // get the width and height of the texture
// put the location where we want the texture to be drawn into a rectangle
// I'm also scaling the texture 2x simply by setting the width and height
SDL_Rect texr; texr.x = WIDTH/2; texr.y = HEIGHT/2; texr.w = w*2; texr.h = h*2;
// main loop
while (1) {
// event handling
SDL_Event e;
if ( SDL_PollEvent(&e) ) {
if (e.type == SDL_QUIT)
break;
else if (e.type == SDL_KEYUP && e.key.keysym.sym == SDLK_ESCAPE)
break;
}
// clear the screen
SDL_RenderClear(renderer);
// copy the texture to the rendering context
SDL_RenderCopy(renderer, img, NULL, &texr);
// flip the backbuffer
// this means that everything that we prepared behind the screens is actually shown
SDL_RenderPresent(renderer);
}
SDL_DestroyTexture(img);
SDL_DestroyRenderer(renderer);
SDL_DestroyWindow(win);
return 0;
}
this gave me this error:
Code:
main.cpp
aarch64-none-elf-g++ -MMD -MP -MF /home/Anwender/Desktop/FuseeGelee/image/build/main.d -g -Wall -O2 -ffunction-sections -march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIE -D__SWITCH__ -I/home/Anwender/Desktop/FuseeGelee/image/include -I/opt/devkitpro/portlibs/switch/include -I/opt/devkitpro/libnx/include -I/home/Anwender/Desktop/FuseeGelee/image/build `sdl2-config --cflags` -fno-rtti -fno-exceptions -c /home/Anwender/Desktop/FuseeGelee/image/source/main.cpp -o main.o
linking image.elf
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: main.o: in function `main':
C:/Users/Anwender/Desktop/FuseeGelee/image/source/main.cpp:27: undefined reference to `IMG_LoadTexture'
collect2.exe: error: ld returned 1 exit status
make[1]: *** [/opt/devkitpro/libnx/switch_rules:80: /home/Anwender/Desktop/FuseeGelee/image/image.elf] Error 1
make: *** [Makefile:165: build] Error 2
It gaves me a Makefile error so i thought i need to add a libary.
Code:
LIBS := -lSDL2_image `sdl2-config --libs`
But i got even more errors:
Code:
main.cpp
aarch64-none-elf-g++ -MMD -MP -MF /home/Anwender/Desktop/FuseeGelee/image/build/main.d -g -Wall -O2 -ffunction-sections -march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIE -D__SWITCH__ -I/home/Anwender/Desktop/FuseeGelee/image/include -I/opt/devkitpro/portlibs/switch/include -I/opt/devkitpro/libnx/include -I/home/Anwender/Desktop/FuseeGelee/image/build `sdl2-config --cflags` -fno-rtti -fno-exceptions -c /home/Anwender/Desktop/FuseeGelee/image/source/main.cpp -o main.o
linking image.elf
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: C:/devkitPro/portlibs/switch/lib\libSDL2_image.a(IMG_jpg.o): in function `IMG_InitJPG':
/home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_jpg.c:88: undefined reference to `jpeg_calc_output_dimensions'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_jpg.c:89: undefined reference to `jpeg_CreateDecompress'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_jpg.c:90: undefined reference to `jpeg_destroy_decompress'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_jpg.c:91: undefined reference to `jpeg_finish_decompress'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_jpg.c:88: undefined reference to `jpeg_calc_output_dimensions'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_jpg.c:92: undefined reference to `jpeg_read_header'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_jpg.c:93: undefined reference to `jpeg_read_scanlines'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_jpg.c:94: undefined reference to `jpeg_resync_to_restart'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_jpg.c:95: undefined reference to `jpeg_start_decompress'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_jpg.c:89: undefined reference to `jpeg_CreateDecompress'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_jpg.c:96: undefined reference to `jpeg_CreateCompress'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_jpg.c:97: undefined reference to `jpeg_start_compress'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_jpg.c:98: undefined reference to `jpeg_set_quality'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_jpg.c:99: undefined reference to `jpeg_set_defaults'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_jpg.c:90: undefined reference to `jpeg_destroy_decompress'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_jpg.c:100: undefined reference to `jpeg_write_scanlines'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_jpg.c:101: undefined reference to `jpeg_finish_compress'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_jpg.c:102: undefined reference to `jpeg_destroy_compress'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_jpg.c:103: undefined reference to `jpeg_std_error'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_jpg.c:91: undefined reference to `jpeg_finish_decompress'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_jpg.c:92: undefined reference to `jpeg_read_header'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_jpg.c:93: undefined reference to `jpeg_read_scanlines'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_jpg.c:94: undefined reference to `jpeg_resync_to_restart'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_jpg.c:95: undefined reference to `jpeg_start_decompress'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_jpg.c:96: undefined reference to `jpeg_CreateCompress'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_jpg.c:97: undefined reference to `jpeg_start_compress'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_jpg.c:98: undefined reference to `jpeg_set_quality'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_jpg.c:99: undefined reference to `jpeg_set_defaults'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_jpg.c:100: undefined reference to `jpeg_write_scanlines'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_jpg.c:101: undefined reference to `jpeg_finish_compress'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_jpg.c:102: undefined reference to `jpeg_destroy_compress'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_jpg.c:103: undefined reference to `jpeg_std_error'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: C:/devkitPro/portlibs/switch/lib\libSDL2_image.a(IMG_png.o): in function `IMG_InitPNG':
/home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:140: undefined reference to `png_create_info_struct'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:141: undefined reference to `png_create_read_struct'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:142: undefined reference to `png_destroy_read_struct'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:143: undefined reference to `png_get_IHDR'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:144: undefined reference to `png_get_io_ptr'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:145: undefined reference to `png_get_channels'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:146: undefined reference to `png_get_PLTE'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:147: undefined reference to `png_get_tRNS'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:148: undefined reference to `png_get_valid'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:149: undefined reference to `png_read_image'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:150: undefined reference to `png_read_info'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:151: undefined reference to `png_read_update_info'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:152: undefined reference to `png_set_expand'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:153: undefined reference to `png_set_gray_to_rgb'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:140: undefined reference to `png_create_info_struct'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:154: undefined reference to `png_set_packing'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:155: undefined reference to `png_set_read_fn'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:141: undefined reference to `png_create_read_struct'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:156: undefined reference to `png_set_strip_16'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:142: undefined reference to `png_destroy_read_struct'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:143: undefined reference to `png_get_IHDR'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:157: undefined reference to `png_set_interlace_handling'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:158: undefined reference to `png_sig_cmp'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:144: undefined reference to `png_get_io_ptr'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:145: undefined reference to `png_get_channels'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:160: undefined reference to `png_set_longjmp_fn'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:162: undefined reference to `png_create_write_struct'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:146: undefined reference to `png_get_PLTE'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:147: undefined reference to `png_get_tRNS'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:163: undefined reference to `png_destroy_write_struct'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:164: undefined reference to `png_set_write_fn'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:148: undefined reference to `png_get_valid'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:149: undefined reference to `png_read_image'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:165: undefined reference to `png_set_IHDR'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:166: undefined reference to `png_write_info'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:150: undefined reference to `png_read_info'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:151: undefined reference to `png_read_update_info'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:167: undefined reference to `png_set_rows'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:168: undefined reference to `png_write_png'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:152: undefined reference to `png_set_expand'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:153: undefined reference to `png_set_gray_to_rgb'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:169: undefined reference to `png_set_PLTE'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:154: undefined reference to `png_set_packing'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:155: undefined reference to `png_set_read_fn'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:156: undefined reference to `png_set_strip_16'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:157: undefined reference to `png_set_interlace_handling'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:158: undefined reference to `png_sig_cmp'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:160: undefined reference to `png_set_longjmp_fn'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:162: undefined reference to `png_create_write_struct'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:163: undefined reference to `png_destroy_write_struct'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:164: undefined reference to `png_set_write_fn'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:165: undefined reference to `png_set_IHDR'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:166: undefined reference to `png_write_info'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:167: undefined reference to `png_set_rows'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:168: undefined reference to `png_write_png'
c:/devkitpro/devkita64/bin/../lib/gcc/aarch64-none-elf/8.2.0/../../../../aarch64-none-elf/bin/ld.exe: /home/davem/projects/devkitpro/pacman-packages/switch/SDL2_image/src/SDL2_image-2.0.3/IMG_png.c:169: undefined reference to `png_set_PLTE'
collect2.exe: error: ld returned 1 exit status
make[1]: *** [/opt/devkitpro/libnx/switch_rules:80: /home/Anwender/Desktop/FuseeGelee/image/image.elf] Error 1
make: *** [Makefile:165: build] Error 2
thats my makefile:
Code:
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITPRO)),)
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>/devkitpro")
endif
TOPDIR ?= $(CURDIR)
include $(DEVKITPRO)/libnx/switch_rules
#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# DATA is a list of directories containing data files
# INCLUDES is a list of directories containing header files
# ROMFS is the directory containing data to be added to RomFS, relative to the Makefile (Optional)
#
# NO_ICON: if set to anything, do not use icon.
# NO_NACP: if set to anything, no .nacp file is generated.
# APP_TITLE is the name of the app stored in the .nacp file (Optional)
# APP_AUTHOR is the author of the app stored in the .nacp file (Optional)
# APP_VERSION is the version of the app stored in the .nacp file (Optional)
# APP_TITLEID is the titleID of the app stored in the .nacp file (Optional)
# ICON is the filename of the icon (.jpg), relative to the project folder.
# If not set, it attempts to use one of the following (in this order):
# - <Project name>.jpg
# - icon.jpg
# - <libnx folder>/default_icon.jpg
#
# CONFIG_JSON is the filename of the NPDM config file (.json), relative to the project folder.
# If not set, it attempts to use one of the following (in this order):
# - <Project name>.json
# - config.json
# If a JSON file is provided or autodetected, an ExeFS PFS0 (.nsp) is built instead
# of a homebrew executable (.nro). This is intended to be used for sysmodules.
# NACP building is skipped as well.
#---------------------------------------------------------------------------------
TARGET := $(notdir $(CURDIR))
BUILD := build
SOURCES := source
DATA := data
INCLUDES := include
ROMFS := romfs
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIE
CFLAGS := -g -Wall -O2 -ffunction-sections \
$(ARCH) $(DEFINES)
CFLAGS += -D__SWITCH__ $(INCLUDE) `sdl2-config --cflags`
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
LIBS := -lSDL2_image `sdl2-config --libs` <----- I Edited this line so the first compilation didnt had the lSDL2_image Libary included.
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(PORTLIBS) $(LIBNX)
#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------
export OUTPUT := $(CURDIR)/$(TARGET)
export TOPDIR := $(CURDIR)
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
export DEPSDIR := $(CURDIR)/$(BUILD)
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
#---------------------------------------------------------------------------------
export LD := $(CC)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LD := $(CXX)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES)))
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/$(BUILD)
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
ifeq ($(strip $(CONFIG_JSON)),)
jsons := $(wildcard *.json)
ifneq (,$(findstring $(TARGET).json,$(jsons)))
export APP_JSON := $(TOPDIR)/$(TARGET).json
else
ifneq (,$(findstring config.json,$(jsons)))
export APP_JSON := $(TOPDIR)/config.json
endif
endif
else
export APP_JSON := $(TOPDIR)/$(CONFIG_JSON)
endif
ifeq ($(strip $(ICON)),)
icons := $(wildcard *.jpg)
ifneq (,$(findstring $(TARGET).jpg,$(icons)))
export APP_ICON := $(TOPDIR)/$(TARGET).jpg
else
ifneq (,$(findstring icon.jpg,$(icons)))
export APP_ICON := $(TOPDIR)/icon.jpg
endif
endif
else
export APP_ICON := $(TOPDIR)/$(ICON)
endif
ifeq ($(strip $(NO_ICON)),)
export NROFLAGS += --icon=$(APP_ICON)
endif
ifeq ($(strip $(NO_NACP)),)
export NROFLAGS += --nacp=$(CURDIR)/$(TARGET).nacp
endif
ifneq ($(APP_TITLEID),)
export NACPFLAGS += --titleid=$(APP_TITLEID)
endif
ifneq ($(ROMFS),)
export NROFLAGS += --romfsdir=$(CURDIR)/$(ROMFS)
endif
.PHONY: $(BUILD) clean all
#---------------------------------------------------------------------------------
all: $(BUILD)
$(BUILD):
@[ -d $@ ] || mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
clean:
@echo clean ...
ifeq ($(strip $(APP_JSON)),)
@rm -fr $(BUILD) $(TARGET).nro $(TARGET).nacp $(TARGET).elf
else
@rm -fr $(BUILD) $(TARGET).nsp $(TARGET).nso $(TARGET).npdm $(TARGET).elf
endif
#---------------------------------------------------------------------------------
else
.PHONY: all
DEPENDS := $(OFILES:.o=.d)
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
ifeq ($(strip $(APP_JSON)),)
all : $(OUTPUT).nro
ifeq ($(strip $(NO_NACP)),)
$(OUTPUT).nro : $(OUTPUT).elf $(OUTPUT).nacp
else
$(OUTPUT).nro : $(OUTPUT).elf
endif
else
all : $(OUTPUT).nsp
$(OUTPUT).nsp : $(OUTPUT).nso $(OUTPUT).npdm
$(OUTPUT).nso : $(OUTPUT).elf
endif
$(OUTPUT).elf : $(OFILES)
$(OFILES_SRC) : $(HFILES_BIN)
#---------------------------------------------------------------------------------
# you need a rule like this for each extension you use as binary data
#---------------------------------------------------------------------------------
%.bin.o %_bin.h : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
-include $(DEPENDS)
#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------
its based on the Sdl2-simple example from devkitpro.
and yes i installed the SDL2 Libary with MSYS2
Code:
dkp-libs switch-bulletphysics 2.88-2 [Installiert]
dkp-libs switch-bzip2 1.0.6-2 [Installiert]
dkp-libs switch-curl 7.59.0-1 [Installiert]
dkp-libs switch-examples 20190102-1 [Installiert]
dkp-libs switch-ffmpeg 4.0.1-2 [Installiert]
dkp-libs switch-flac 1.3.2-1 [Installiert]
dkp-libs switch-freetype 2.9-3 [Installiert]
dkp-libs switch-giflib 5.1.4-1 [Installiert]
dkp-libs switch-glad 0.1.27-1 [Installiert]
dkp-libs switch-glm 0.9.9.1-1 [Installiert]
dkp-libs switch-jansson 2.11-1 [Installiert]
dkp-libs switch-libass 0.14.0-1 [Installiert]
dkp-libs switch-libconfig 1.7.2-1 [Installiert]
dkp-libs switch-libdrm_nouveau 1.0.0-1 [Installiert]
dkp-libs switch-libexpat 2.2.5-1 [Installiert]
dkp-libs switch-libfribidi 1.0.4-1 [Installiert]
dkp-libs switch-libjpeg-turbo 1.5.3-1 [Installiert]
dkp-libs switch-libjson-c 0.13.1-1 [Installiert]
dkp-libs switch-libmad 0.15.1b-1 [Installiert]
dkp-libs switch-libmikmod 3.3.11.1-2 [Installiert]
dkp-libs switch-libmodplug 0.8.8.5-1 [Installiert]
dkp-libs switch-libogg 1.3.3-1 [Installiert]
dkp-libs switch-libopus 1.2.1-1 [Installiert]
dkp-libs switch-libpng 1.6.34-3 [Installiert]
dkp-libs switch-libsamplerate 0.1.9-1 [Installiert]
dkp-libs switch-libtheora 1.1.1-1 [Installiert]
dkp-libs switch-libvorbis 1.3.5-1 [Installiert]
dkp-libs switch-libvorbisidec 1.2.1-1 [Installiert]
dkp-libs switch-libxml2 2.9.8-1 [Installiert]
dkp-libs switch-mesa 18.3-2 [Installiert]
dkp-libs switch-mpg123 1.25.10-2 [Installiert]
dkp-libs switch-opusfile 0.10-3 [Installiert]
dkp-libs switch-pkg-config 0.28-2 [Installiert]
dkp-libs switch-sdl2 2.0.8-17 [Installiert]
dkp-libs switch-sdl2_gfx 1.0.4-1 [Installiert]
dkp-libs switch-sdl2_image 2.0.3-3 [Installiert]
dkp-libs switch-sdl2_mixer 2.0.2-2 [Installiert]
dkp-libs switch-sdl2_net 2.0.1-1 [Installiert]
dkp-libs switch-sdl2_ttf 2.0.14-2 [Installiert]
dkp-libs switch-zlib 1.2.11-2 [Installiert]
sorry for many code spoilers.
guess its something with the makefile and im not very good when people talk about makefiles. hope some can help me.
BTW the main file name's main.cpp
the makefile name's Makefile
and the romfs is correct
after writing this all i looked in a example and there stand i need to init the romfs first with romfsInit().
after rewriting everything again.
i needed got an unknown reference error with romfsinit.
so i entered lnx after all libs
so thats my new Makefile.
other things are all the still the same like pictures.
Code:
#include <stdio.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <string.h>
#include <errno.h>
#define WIDTH 800
#define HEIGHT 600
int main (int argc, char *argv[]) {
romfsInit();
#define IMG_PATH "romfs:/image.png"
// variable declarations
SDL_Window *win = NULL;
SDL_Renderer *renderer = NULL;
SDL_Texture *img = NULL;
int w, h; // texture width & height
// Initialize SDL.
if (SDL_Init(SDL_INIT_VIDEO) < 0)
return 1;
// create the window and renderer
// note that the renderer is accelerated
win = SDL_CreateWindow("Image Loading", 100, 100, WIDTH, HEIGHT, 0);
renderer = SDL_CreateRenderer(win, -1, SDL_RENDERER_ACCELERATED);
// load our image
img = IMG_LoadTexture(renderer, IMG_PATH);
SDL_QueryTexture(img, NULL, NULL, &w, &h); // get the width and height of the texture
// put the location where we want the texture to be drawn into a rectangle
// I'm also scaling the texture 2x simply by setting the width and height
SDL_Rect texr; texr.x = WIDTH/2; texr.y = HEIGHT/2; texr.w = w*2; texr.h = h*2;
// main loop
while (1) {
// event handling
SDL_Event e;
if ( SDL_PollEvent(&e) ) {
if (e.type == SDL_QUIT)
break;
else if (e.type == SDL_KEYUP && e.key.keysym.sym == SDLK_ESCAPE)
break;
}
// clear the screen
SDL_RenderClear(renderer);
// copy the texture to the rendering context
SDL_RenderCopy(renderer, img, NULL, &texr);
// flip the backbuffer
// this means that everything that we prepared behind the screens is actually shown
SDL_RenderPresent(renderer);
}
SDL_DestroyTexture(img);
SDL_DestroyRenderer(renderer);
SDL_DestroyWindow(win);
return 0;
}
i needed got an unknown reference error with romfsinit.
so i entered lnx after all libs
so thats my new Makefile.
Code:
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITPRO)),)
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>/devkitpro")
endif
TOPDIR ?= $(CURDIR)
include $(DEVKITPRO)/libnx/switch_rules
#---------------------------------------------------------------------------------
# TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# DATA is a list of directories containing data files
# INCLUDES is a list of directories containing header files
# ROMFS is the directory containing data to be added to RomFS, relative to the Makefile (Optional)
#
# NO_ICON: if set to anything, do not use icon.
# NO_NACP: if set to anything, no .nacp file is generated.
# APP_TITLE is the name of the app stored in the .nacp file (Optional)
# APP_AUTHOR is the author of the app stored in the .nacp file (Optional)
# APP_VERSION is the version of the app stored in the .nacp file (Optional)
# APP_TITLEID is the titleID of the app stored in the .nacp file (Optional)
# ICON is the filename of the icon (.jpg), relative to the project folder.
# If not set, it attempts to use one of the following (in this order):
# - <Project name>.jpg
# - icon.jpg
# - <libnx folder>/default_icon.jpg
#
# CONFIG_JSON is the filename of the NPDM config file (.json), relative to the project folder.
# If not set, it attempts to use one of the following (in this order):
# - <Project name>.json
# - config.json
# If a JSON file is provided or autodetected, an ExeFS PFS0 (.nsp) is built instead
# of a homebrew executable (.nro). This is intended to be used for sysmodules.
# NACP building is skipped as well.
#---------------------------------------------------------------------------------
TARGET := $(notdir $(CURDIR))
BUILD := build
SOURCES := source
DATA := data
INCLUDES := include
ROMFS := romfs
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH := -march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIE
CFLAGS := -g -Wall -O2 -ffunction-sections \
$(ARCH) $(DEFINES)
CFLAGS += -D__SWITCH__ $(INCLUDE) `sdl2-config --cflags`
CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
LIBS := -lSDL2_image `sdl2-config --libs` -lnx
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(PORTLIBS) $(LIBNX)
#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------
export OUTPUT := $(CURDIR)/$(TARGET)
export TOPDIR := $(CURDIR)
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
export DEPSDIR := $(CURDIR)/$(BUILD)
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
#---------------------------------------------------------------------------------
export LD := $(CC)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LD := $(CXX)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES)))
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/$(BUILD)
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
ifeq ($(strip $(CONFIG_JSON)),)
jsons := $(wildcard *.json)
ifneq (,$(findstring $(TARGET).json,$(jsons)))
export APP_JSON := $(TOPDIR)/$(TARGET).json
else
ifneq (,$(findstring config.json,$(jsons)))
export APP_JSON := $(TOPDIR)/config.json
endif
endif
else
export APP_JSON := $(TOPDIR)/$(CONFIG_JSON)
endif
ifeq ($(strip $(ICON)),)
icons := $(wildcard *.jpg)
ifneq (,$(findstring $(TARGET).jpg,$(icons)))
export APP_ICON := $(TOPDIR)/$(TARGET).jpg
else
ifneq (,$(findstring icon.jpg,$(icons)))
export APP_ICON := $(TOPDIR)/icon.jpg
endif
endif
else
export APP_ICON := $(TOPDIR)/$(ICON)
endif
ifeq ($(strip $(NO_ICON)),)
export NROFLAGS += --icon=$(APP_ICON)
endif
ifeq ($(strip $(NO_NACP)),)
export NROFLAGS += --nacp=$(CURDIR)/$(TARGET).nacp
endif
ifneq ($(APP_TITLEID),)
export NACPFLAGS += --titleid=$(APP_TITLEID)
endif
ifneq ($(ROMFS),)
export NROFLAGS += --romfsdir=$(CURDIR)/$(ROMFS)
endif
.PHONY: $(BUILD) clean all
#---------------------------------------------------------------------------------
all: $(BUILD)
$(BUILD):
@[ -d $@ ] || mkdir -p $@
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
#---------------------------------------------------------------------------------
clean:
@echo clean ...
ifeq ($(strip $(APP_JSON)),)
@rm -fr $(BUILD) $(TARGET).nro $(TARGET).nacp $(TARGET).elf
else
@rm -fr $(BUILD) $(TARGET).nsp $(TARGET).nso $(TARGET).npdm $(TARGET).elf
endif
#---------------------------------------------------------------------------------
else
.PHONY: all
DEPENDS := $(OFILES:.o=.d)
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
ifeq ($(strip $(APP_JSON)),)
all : $(OUTPUT).nro
ifeq ($(strip $(NO_NACP)),)
$(OUTPUT).nro : $(OUTPUT).elf $(OUTPUT).nacp
else
$(OUTPUT).nro : $(OUTPUT).elf
endif
else
all : $(OUTPUT).nsp
$(OUTPUT).nsp : $(OUTPUT).nso $(OUTPUT).npdm
$(OUTPUT).nso : $(OUTPUT).elf
endif
$(OUTPUT).elf : $(OFILES)
$(OFILES_SRC) : $(HFILES_BIN)
#---------------------------------------------------------------------------------
# you need a rule like this for each extension you use as binary data
#---------------------------------------------------------------------------------
%.bin.o %_bin.h : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
-include $(DEPENDS)
#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------
other things are all the still the same like pictures.
so that was my long thread and i asking for an fix now how to render a image.
btw yes the file names cpp but i really dont want to make CPP programs im C programmer.
but when i rename the Program back to .c then i get these errors.
https://pastebin.com/raw/NeVjuRct warning its very long
so after obtaining the longest thread on earth medal i hope now for getting help