Input file stream on Wii September 23, 2009 03:29PM | Registered: 13 years ago Posts: 34 |
#include#include string> // all these begin with a "<", but I had to remove them in this post #include iostream> #include stdlib.h> #include gccore.h> #include wiiuse/wpad.h> #include fat.h> static void *xfb = NULL; static GXRModeObj *rmode = NULL; void InitWii(); void WaitForHome(); int main() { InitWii(); // calls all the needed init functions // OPEN a text file and print the 1st line on the screen FILE* txt = NULL; if(!fatInitDefault()) printf("\nfatInitDefault() failed."); txt = fopen("info.txt", "r"); if (txt == NULL) printf("\nFile open failed."); char line[50]; fgets(line, sizeof line, txt); for (int i = 0; i < 50; i++) { std::cout << line; } fclose(txt); // wait for HOME on Wiimote WaitForHome(); return 0; }
#--------------------------------------------------------------------------------- # Clear the implicit built in rules #--------------------------------------------------------------------------------- .SUFFIXES: #--------------------------------------------------------------------------------- ifeq ($(strip $(DEVKITPPC)),) $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") endif include $(DEVKITPPC)/wii_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 # INCLUDES is a list of directories containing extra header files #--------------------------------------------------------------------------------- TARGET := $(notdir $(CURDIR)) BUILD := build SOURCES := source DATA := data INCLUDES := #--------------------------------------------------------------------------------- # options for code generation #--------------------------------------------------------------------------------- CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) CXXFLAGS = $(CFLAGS) LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map #--------------------------------------------------------------------------------- # any extra libraries we wish to link with the project #--------------------------------------------------------------------------------- LIBS := -lwiiuse -lbte -logc -lm -lfat #--------------------------------------------------------------------------------- # list of directories containing libraries, this must be the top level containing # include and lib #--------------------------------------------------------------------------------- LIBDIRS := #--------------------------------------------------------------------------------- # 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 VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ $(foreach dir,$(DATA),$(CURDIR)/$(dir)) export DEPSDIR := $(CURDIR)/$(BUILD) #--------------------------------------------------------------------------------- # automatically build a list of object files for our project #--------------------------------------------------------------------------------- CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) 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 := $(addsuffix .o,$(BINFILES)) \ $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ $(sFILES:.s=.o) $(SFILES:.S=.o) #--------------------------------------------------------------------------------- # build a list of include paths #--------------------------------------------------------------------------------- export INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \ $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ -I$(CURDIR)/$(BUILD) \ -I$(LIBOGC_INC) #--------------------------------------------------------------------------------- # build a list of library paths #--------------------------------------------------------------------------------- export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ -L$(LIBOGC_LIB) export OUTPUT := $(CURDIR)/$(TARGET) .PHONY: $(BUILD) clean #--------------------------------------------------------------------------------- $(BUILD): @[ -d $@ ] || mkdir -p $@ @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile #--------------------------------------------------------------------------------- clean: @echo clean ... @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol #--------------------------------------------------------------------------------- run: wiiload $(TARGET).dol #--------------------------------------------------------------------------------- else DEPENDS := $(OFILES:.o=.d) #--------------------------------------------------------------------------------- # main targets #--------------------------------------------------------------------------------- $(OUTPUT).dol: $(OUTPUT).elf $(OUTPUT).elf: $(OFILES) #--------------------------------------------------------------------------------- # This rule links in binary data with the .jpg extension #--------------------------------------------------------------------------------- %.jpg.o : %.jpg #--------------------------------------------------------------------------------- @echo $(notdir $<) $(bin2o) -include $(DEPENDS) #--------------------------------------------------------------------------------- endif #---------------------------------------------------------------------------------
Quote
devkitPro
> "make"
main.cpp
linking ... text_reader.elf
c:/devkitPro/libogc/lib/wii\libfat.a(disc.o): In function `get_io_wiisd':
/Users/davem/projects/devkitpro/libnds-master/libfat/libogc/../source/disc.c:48: undefined reference to `__io_wiisd'
/Users/davem/projects/devkitpro/libnds-master/libfat/libogc/../source/disc.c:48: undefined reference to `__io_wiisd'
c:/devkitPro/libogc/lib/wii\libfat.a(disc.o): In function `get_io_usbstorage':
/Users/davem/projects/devkitpro/libnds-master/libfat/libogc/../source/disc.c:51: undefined reference to `__io_usbstorage'
/Users/davem/projects/devkitpro/libnds-master/libfat/libogc/../source/disc.c:51: undefined reference to `__io_usbstorage'
collect2: ld returned 1 exit status
make[1]: *** [/c/projects/wii/text_reader/text_reader.elf] Error 1
"make": *** [build] Error 2
> Process Exit Code: 2
> Time Taken: 00:01
Re: Input file stream on Wii September 23, 2009 05:03PM | Registered: 14 years ago Posts: 175 |
Re: Input file stream on Wii September 23, 2009 10:07PM | Registered: 13 years ago Posts: 34 |
Quote
devkitPro
> "make"
linking ... Risen.elf
c:/devkitpro/devkitppc/bin/../lib/gcc/powerpc-gekko/4.2.4/../../../../powerpc-gekko/lib\libc.a(lib_a-system.o): In function `_system_r':
(.text+0xbc): undefined reference to `_execve'
collect2: ld returned 1 exit status
make[1]: *** [/c/projects/wii/Risen/Risen.elf] Error 1
"make": *** [build] Error 2
> Process Exit Code: 2
> Time Taken: 00:01
Re: Input file stream on Wii September 23, 2009 10:14PM | Registered: 14 years ago Posts: 175 |
Re: Input file stream on Wii September 23, 2009 10:21PM | Registered: 13 years ago Posts: 34 |
Re: Input file stream on Wii September 23, 2009 10:32PM | Registered: 14 years ago Posts: 175 |
Re: Input file stream on Wii September 23, 2009 10:34PM | Registered: 13 years ago Posts: 34 |
47: plyr = ProcessSection(tb, plyr); 57: plyr = ProcessBattle(btl_data, plyr);
Re: Input file stream on Wii September 23, 2009 10:58PM | Registered: 14 years ago Posts: 175 |
Re: Input file stream on Wii September 23, 2009 11:05PM | Registered: 14 years ago Posts: 175 |
Re: Input file stream on Wii September 24, 2009 02:32AM | Registered: 14 years ago Posts: 98 |
Re: Input file stream on Wii September 24, 2009 01:39PM | Registered: 14 years ago Posts: 265 |