Coding with Eclipse tutorial
Posted: Sat Jul 31, 2010 11:16 pm
Hello,
I've taken a tutorial to set Eclipse up for wiidev. And it worked fine, but as soon as i tried wiisprite, a problem arose. I get an error saying:
does this mean that it's trying to look for libwiisprite.a?
for anyone interested, here's my makefile
and my.cpp
would really appreciate your help.
Thanks
I've taken a tutorial to set Eclipse up for wiidev. And it worked fine, but as soon as i tried wiisprite, a problem arose. I get an error saying:
Code: Select all
c:/devkitpro/devkitppc/bin/../lib/gcc/powerpc-eabi/4.4.3/../../../../powerpc-eabi/bin/ld.exe: cannot find -lwiisprite
for anyone interested, here's my makefile
Code: Select all
#---------------------------------------------------------------------------------
# Clear the implicit built in rules
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>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
INCLUDES := include
DATA := data
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) -I(DEVKITPPC)/local/include
CXXFLAGS = $(CFLAGS)
LDFLAGS = -g $(MACHDEP) -mrvl -Wl,-Map,$(notdir $@).map
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS := -lwiisprite -lpng -lz -lwiiuse -lbte -lfat -logc -lm
#---------------------------------------------------------------------------------
# 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),-I$(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) -L$(DEVKITPPC)/local/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:
psoload $(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)
#---------------------------------------------------------------------------------
# This rule links in binary data with the .png extension
#---------------------------------------------------------------------------------
%.png.o : %.png
#---------------------------------------------------------------------------------
@echo $(notdir $<)
$(bin2o)
-include $(DEPENDS)
#---------------------------------------------------------------------------------
# This rule links in binary data with the .mp3 extension
#---------------------------------------------------------------------------------
%.mp3.o : %.mp3
#---------------------------------------------------------------------------------
@echo $(notdir $<)
$(bin2o)
-include $(DEPENDS)
#---------------------------------------------------------------------------------
# This rule links in binary data
#---------------------------------------------------------------------------------
%.bin.o : %.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
%.mod.o : %.mod
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
-include $(DEPENDS)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
Code: Select all
#include <stdio.h>
#include <stdlib.h>
#include <gccore.h>
#include <wiiuse/wpad.h>
#include <fat.h>
#include "board_jpg.h"
#include "Green00_jpg.h"
#include "Green01_jpg.h"
#include "Green02_jpg.h"
#include "Green10_jpg.h"
#include "Green11_jpg.h"
#include "Green12_jpg.h"
#include "Green20_jpg.h"
#include "Green21_jpg.h"
#include "Green22_jpg.h"
#include "Pink00_jpg.h"
#include "Pink01_jpg.h"
#include "Pink02_jpg.h"
#include "Pink10_jpg.h"
#include "Pink11_jpg.h"
#include "Pink12_jpg.h"
#include "Pink20_jpg.h"
#include "Pink21_jpg.h"
#include "Pink22_jpg.h"
#include <wiisprite.h> // The main libwiisprite header.
using namespace wsp; // To not make us type this again and again
//#include <libwiisprite.h> // This is the header file we got from the devkitPPC tool "raw2c"
int main(int argc, char **argv)
{
// Create the game window and initalise the VIDEO subsystem
GameWindow gwd;
gwd.InitVideo();
gwd.SetBackground((GXColor){ 255, 255, 255, 255 });
LayerManager manager(5);
//load images
Image bg;
Image g00, p00;
Image g01, p01;
Image g02, p02;
Image g10, p10;
Image g11, p11;
Image g12, p12;
Image g20, p20;
Image g21, p21;
Image g22, p22;
Sprite sprites[] ={sbg, sg00, sp00, sg01, sp01, sg02, sp02, sg10, sp10, sg11,
sp11, sg12, sp12, sg20, sp20, sg21, sp21, sg22, sp22};
/*Sprite sbg, sg00, sp00, sg01, sp01, sg02, sp02, sg10, sp10, sg11,
sp11, sg12, sp12, sg20, sp20, sg21, sp21, sg22, sp22;*/
if( bg.LoadImage(board) != IMG_LOAD_ERROR_NONE)exit(0);
if( g00.LoadImage(Green00) != IMG_LOAD_ERROR_NONE)exit(0);
if( g01.LoadImage(Green01) != IMG_LOAD_ERROR_NONE)exit(0);
if( g02.LoadImage(Green02) != IMG_LOAD_ERROR_NONE)exit(0);
if( g10.LoadImage(Green10) != IMG_LOAD_ERROR_NONE)exit(0);
if( g11.LoadImage(Green11) != IMG_LOAD_ERROR_NONE)exit(0);
if( g12.LoadImage(Green12) != IMG_LOAD_ERROR_NONE)exit(0);
if( g20.LoadImage(Green20) != IMG_LOAD_ERROR_NONE)exit(0);
if( g21.LoadImage(Green21) != IMG_LOAD_ERROR_NONE)exit(0);
if( g22.LoadImage(Green22) != IMG_LOAD_ERROR_NONE)exit(0);
if( p00.LoadImage(Pink00) != IMG_LOAD_ERROR_NONE)exit(0);
if( p01.LoadImage(Pink01) != IMG_LOAD_ERROR_NONE)exit(0);
if( p02.LoadImage(Pink02) != IMG_LOAD_ERROR_NONE)exit(0);
if( p10.LoadImage(Pink10) != IMG_LOAD_ERROR_NONE)exit(0);
if( p11.LoadImage(Pink11) != IMG_LOAD_ERROR_NONE)exit(0);
if( p12.LoadImage(Pink12) != IMG_LOAD_ERROR_NONE)exit(0);
if( p20.LoadImage(Pink20) != IMG_LOAD_ERROR_NONE)exit(0);
if( p21.LoadImage(Pink21) != IMG_LOAD_ERROR_NONE)exit(0);
if( p22.LoadImage(Pink22) != IMG_LOAD_ERROR_NONE)exit(0);
sbg.SetImage(&bg);
sbg.SetPosition(0,0);
sg00.SetImage(&g00);
sg00.SetPosition(106.75, 80.5);
sp00.SetImage(&p00);
sp00.SetPosition(106.75, 80.5);
sg01.SetImage(&g01);
sg01.SetPosition(319.83, 80.5);
sp01.SetImage(&p01);
sp01.SetPosition(319.83, 80.5);
sg02.SetImage(&g02);
sg02.SetPosition(523.83, 80.17);
sp02.SetImage(&p02);
sp02.SetPosition(523.83, 80.17);
sg10.SetImage(&g10);
sg10.SetPosition(107.17, 241.17);
sp10.SetImage(&p10);
sp10.SetPosition(107.17, 241.17);
sg11.SetImage(&g11);
sg11.SetPosition(320.29, 241.33);
sp11.SetImage(&p11);
sp11.SetPosition(320.29, 241.33);
sg12.SetImage(&g12);
sg12.SetPosition(532.96, 241.17);
sp12.SetImage(&p12);
sp12.SetPosition(532.96, 241.17);
sg20.SetImage(&g20);
sg20.SetPosition(107.46, 399.83);
sp20.SetImage(&p20);
sp20.SetPosition(107.46, 399.83);
sg21.SetImage(&g21);
sg21.SetPosition(320.13, 399.75);
sp21.SetImage(&p21);
sp21.SetPosition(320.13, 399.75);
sg22.SetImage(&g22);
sg22.SetPosition(532.92, 400.04);
sp22.SetImage(&p22);
sp22.SetPosition(532.92, 400.04);
// Initialise Wiimote
WPAD_Init();
for(;;)
{
WPAD_ScanPads();
if(WPAD_ButtonsDown(WPAD_CHAN_0)&WPAD_BUTTON_HOME)
break;
gwd.Flush();
}
return 0;
}
Thanks