r/homebrew • • 11h ago

Question/Help Help to compile a C++ file to a .dol (Wii)

Hi, since the past week, i've been working on a Wii console app test that runs on HomeBrew Channel, the code its prefectly fine but when I try to compile the code with MINGW64 with all of the headers in the right folder, the compiler of DevkitPro just says that the headers were not found, anyone can help me?

This is the C++ code:

#include <gccore.h>
#include <wiiuse/wpad.h>
#include <cstdio>


int main(int argc, char **argv) {



VIDEO_Init();


CON_Init(NULL, 32, 64, 640, 480, 256);


WPAD_Init();


std::printf("====================================\n");
std::printf("Welcome to the terminal!\n");
std::printf("====================================\n");
std::printf("To exit, press HOME\n\n");


while (true) {


u32 pressed_buttons = WPAD_ButtonsDown(0);


if (pressed_buttons & WPAD_BUTTON_HOME) {


    std::printf("Closing terminal...");
    break;


}


VIDEO_WaitVSync();


}


return 0;
}

This is the Makefile:

export DEVKITPRO := D:/DevkitPro
export DEVKITPPC := D:/DevkitPro/devkitPPC
export PORTLIBS  := D:/DevkitPro/portlibs/wii


ifeq ($(strip $(DEVKITPRO)),)
$(error "Por favor, define la variable de entorno DEVKITPRO en tu sistema")
endif


include $(DEVKITPRO)/devkitPPC/wii_rules



TARGET      :=  WiiRepoClient
DEBUG       :=  0
SOURCES     :=  source
INCLUDES    :=  include



CFLAGS      :=  -g -O2 -Wall -DGEKKO -D__wii__ $(MACHDEP)
CXXFLAGS    :=  $(CFLAGS) -std=c++23 -fno-exceptions -fno-rtti



LIBS        :=  -lfreetype -lpng -lz -lwiiuse -lfat -logc -lm
LIBDIRS     :=  $(PORTLIBS)/lib $(LIBOGC_LIB)



INCDIRS     :=  $(PORTLIBS)/include $(DEVKITPRO)/libogc/include $(LIBOGC_INC) $(INCLUDES)





all: $(BUILD)
     Compilacion finalizada con exito.


ifneq ($(BUILD),$(notdir $(CURDIR)))
export OUTPUT   :=  $(CURDIR)/$(TARGET)
export VPATH    :=  $(foreach dir,$(SOURCES),$(CURDIR)/$(dir))
export DEPSDIR  :=  $(CURDIR)/


CFILES      :=  $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES    :=  $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))


export OFILES   :=  $(CFILES:.c=.o) $(CPPFILES:.cpp=.o)


export INCLUDE  :=  $(foreach dir,$(INCDIRS),-I$(CURDIR)/$(dir) -I$(dir))


.PHONY: $(BUILD) clean all


$(BUILD):
    @[ -d $@ ] || mkdir -p $@
     --no-print-directory -C $@ -f $(CURDIR)/Makefile


clean:
     Eliminando archivos temporales viejos...
     -rf $(BUILD) $(OUTPUT).elf $(OUTPUT).dol


else


DEPENDS :=  $(OFILES:.o=.d)


$(OUTPUT).dol: $(OUTPUT).elf
$(OUTPUT).elf: $(OFILES)


-include $(DEPENDS)


endif

And yes, the includes are inside a folder called "include".

2 Upvotes

2 comments sorted by

•

u/AutoModerator 11h ago

Thank you for posting to r/homebrew. Please keep in mind the following: - Piracy is not supported here, and is against the law. - Please read the sticky post as it has answers to many common questions. - This isn't for homebrew beer.

We also have a Discord server where you may be able to get an answer faster: https://discord.gg/PeQvhsrRdh

This is sent on all posts. Your post has not been removed (unless you see a comment stating otherwise)

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/Pure_Wrongdoer_8014 11h ago

Any help is very appreciated, thanks!