Change the CFLAGS variable in your Makefile to this:

Code:
CFLAGS   = -Os -Wall $(MACHDEP) $(INCLUDE) --std=c99
what do you use instead of _bool?
Using an integer should be fine, but you could also do this:

Code:
#define boolean int
#define bool int
souvik1997 wrote:
Using an integer should be fine, but you could also do this:

Code:
#define boolean int
#define bool int


Why not use typedef? It's made for that purpose:


Code:
typedef int boolean;
typedef boolean bool;
my code:

Code:

int keydownlast(int basic_keycode) {
   int row, col, word, bit;
   row = basic_keycode%10;
   col = basic_keycode/10-1;
   word = row>>1;
   bit = col + 8*(row&1);
   return (0 != (lastkey[word] & 1<<bit));
}


the error:

Code:

C:/PrizmSDK-0.3/PrizmSDK-0.3/projects/MathAdd-In/src/MathAdd-In.c:105:18: warnin
g: variable 'word' set but not used [-Wunused-but-set-variable]

any ideas??
That's not an error, that's a warning. That's not holding up the compilation at all. Though, you should still fix it. How? The problem is that it is set, but not used. So it's a useless variable. I'll let you take that information in and make the fix yourself based on what I gave you. Smile
To further elaborate, the compiler usually emits warnings when it detects code that may behave in an unexpected fashion.

In this case, it's warning that you never use that variable, which sometimes indicates a logical error in which you used some other variable than the one you wanted.

I strongly suggest compiling with the -Wall option, and sometimes -Wextra, to make it even more zealous about warnings. With those on, it will often catch expressions and idioms that are not portable to other systems or compilers, and it usually helps to keep your code easy-to-follow.
I have reduced my errors down to one function(I think)


Code:

C:/PrizmSDK-0.3/PrizmSDK-0.3/projects/MathAdd-In/src/MathAdd-In.c: In function '
getTextLine':

C:/PrizmSDK-0.3/PrizmSDK-0.3/projects/MathAdd-In/src/MathAdd-In.c:156:2: warning
: implicit declaration of function 'RTC_GetTicks' [-Wimplicit-function-declarati
on]

C:/PrizmSDK-0.3/PrizmSDK-0.3/projects/MathAdd-In/src/MathAdd-In.c:232:23: error:
 'KEY_PRGM_DEL' undeclared (first use in this function)

C:/PrizmSDK-0.3/PrizmSDK-0.3/projects/MathAdd-In/src/MathAdd-In.c:232:23: note:
each undeclared identifier is reported only once for each function it appears in

C:/PrizmSDK-0.3/PrizmSDK-0.3/projects/MathAdd-In/src/MathAdd-In.c:252:8: warning
: implicit declaration of function '_g_strlen' [-Wimplicit-function-declaration]



Any ideas on how fix them.
You're either missing a header or attempting to use something that doesn't exist.

Code:
$ grep -R KEY_PRGM_DEL include/
$
No such thing.
Code:
$ grep -R DEL include/
include/fxcg_keyboard.h:#define KEY_CTRL_DEL        30025
include/fxcg_keyboard.h:// KEY_CTRL_DEL 0x7549 (30025)
include/keyboard.hpp:#define KEY_CTRL_DEL        30025
include/keyboard.hpp:// KEY_CTRL_DEL    0x7549 (30025)
$
You probably meant KEY_CTRL_DEL.

Maybe I'm assuming an unreasonable amount of knowledge, but the message that it's undeclared should be a good hint that it doesn't know what you mean, right? Learn to read error messages and suddenly it becomes easier to figure out your problems..
KEY_PRGM_DEL isn't in any of the include files:

Code:
#define KEY_PRGM_DEL 44
So how would you declare RTC_GetTicks, and _g_strlen?

Edit: I think I declared them right because they don't pop up. Now I get this:

Code:
C:\PrizmSDK-0.3\PrizmSDK-0.3\projects\MathAdd-In>..\..\bin\make.exe
sh3eb-elf-gcc -MMD -MP -MF C:/PrizmSDK-0.3/PrizmSDK-0.3/projects/MathAdd-In/buil
d/MathAdd-In.d -Os -Wall -mb -m4a-nofpu -mhitachi -nostdlib   -IC:/PrizmSDK-0.3/
PrizmSDK-0.3/projects/MathAdd-In/build -IC:/PrizmSDK-0.3/PrizmSDK-0.3/include --
std=c99 -c C:/PrizmSDK-0.3/PrizmSDK-0.3/projects/MathAdd-In/src/MathAdd-In.c -o
MathAdd-In.o
sh3eb-elf-gcc  MathAdd-In.o -mb -m4a-nofpu -mhitachi -nostdlib -TC:/PrizmSDK-0.3
/PrizmSDK-0.3/common/prizm.ld -Wl,-static -Wl,-gc-sections -std=c99  -LC:/PrizmS
DK-0.3/PrizmSDK-0.3/lib -lfxcg -lgcc -o C:/PrizmSDK-0.3/PrizmSDK-0.3/projects/Ma
thAdd-In/MathAdd-In.bin
MathAdd-In.o: In function `_getTextLine':
MathAdd-In.c:(.text+0x6d4): undefined reference to `__g_strlen'
collect2: ld returned 1 exit status
make[1]: *** [C:/PrizmSDK-0.3/PrizmSDK-0.3/projects/MathAdd-In/MathAdd-In.bin] E
rror 1
make: *** [build] Error 2

C:\PrizmSDK-0.3\PrizmSDK-0.3\projects\MathAdd-In>pause
Press any key to continue . . .
Change _g_strlen to strlen.
New errors:

Code:

C:\PrizmSDK-0.3\PrizmSDK-0.3\projects\MathAdd-In>..\..\bin\make.exe
sh3eb-elf-gcc -MMD -MP -MF C:/PrizmSDK-0.3/PrizmSDK-0.3/projects/MathAdd-In/buil
d/MathAdd-In.d -Os -Wall -mb -m4a-nofpu -mhitachi -nostdlib   -IC:/PrizmSDK-0.3/
PrizmSDK-0.3/projects/MathAdd-In/build -IC:/PrizmSDK-0.3/PrizmSDK-0.3/include --
std=c99 -c C:/PrizmSDK-0.3/PrizmSDK-0.3/projects/MathAdd-In/src/MathAdd-In.c -o
MathAdd-In.o
C:/PrizmSDK-0.3/PrizmSDK-0.3/projects/MathAdd-In/src/MathAdd-In.c: In function '
getTextLine':
C:/PrizmSDK-0.3/PrizmSDK-0.3/projects/MathAdd-In/src/MathAdd-In.c:254:8: warning
: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
C:/PrizmSDK-0.3/PrizmSDK-0.3/projects/MathAdd-In/src/MathAdd-In.c:254:18: warnin
g: incompatible implicit declaration of built-in function 'strlen' [enabled by d
efault]
sh3eb-elf-gcc  MathAdd-In.o -mb -m4a-nofpu -mhitachi -nostdlib -TC:/PrizmSDK-0.3
/PrizmSDK-0.3/common/prizm.ld -Wl,-static -Wl,-gc-sections -std=c99  -LC:/PrizmS
DK-0.3/PrizmSDK-0.3/lib -lfxcg -lgcc -o C:/PrizmSDK-0.3/PrizmSDK-0.3/projects/Ma
thAdd-In/MathAdd-In.bin
mkg3a -n basic:Math Add-in -i uns:../unselected.bmp -i sel:../selected.bmp C:/Pr
izmSDK-0.3/PrizmSDK-0.3/projects/MathAdd-In/MathAdd-In.bin C:/PrizmSDK-0.3/Prizm
SDK-0.3/projects/MathAdd-In/MathAdd-In.g3a
Usage: mkg3a [OPTION] input-file [output-file]

  -i (uns|sel):file
                Load unselected/selected icon from file
  -n lc:name
                Set localized name for language code
  -v
                Show version and license information then exit

Valid values for lc are basic, internal, en, es, de, fr, pt and zh.
Empty lc is an alias for basic.  Unset names will be derived from
basic, which defaults to output file name.

Multiple -n or -i options will all be applied, with the last
specified option overriding previous ones with the same key.
make[1]: *** [C:/PrizmSDK-0.3/PrizmSDK-0.3/projects/MathAdd-In/MathAdd-In.g3a] E
rror 1
make: *** [build] Error 2

C:\PrizmSDK-0.3\PrizmSDK-0.3\projects\MathAdd-In>pause
Press any key to continue . . .

any ideas on how to solve them?
You must be using the latest mkg3a build. Edit your Makefile to use the new parameters.
For RTC_GetTicks(), by the way, you need to include RTC_syscalls.h. Also, are you using gCAS? That's the main reason I would think you would need __g_strlen...
The input routine on this page uses _g_strlen.
souvik1997 wrote:
The input routine on this page uses _g_strlen.
Ahhh, so it does; I was just borrowing it from gCAS, since I wrote _g_strlen for gCAS. Here's the routine, for what it's worth:


Code:
unsigned int _g_strlen(char *a)
{
  int ret = 0;
  while(*(a++)) ret++;
  return ret;
}
AHelper wrote:
You must be using the latest mkg3a build. Edit your Makefile to use the new parameters.

What and How do you use the new parameters?
Did you resize your icons to something other than 92x64 or edit your Makefile?
resize pics:no
Edit makefile: here it is

Code:

#---------------------------------------------------------------------------------
# Clear the implicit built in rules
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
# Set toolchain location in an environment var for future use, this will change
# to use a system environment var in the future.
#---------------------------------------------------------------------------------
ifeq ($(strip $(FXCGSDK)),)
export FXCGSDK := $(abspath ../../)
endif

include $(FXCGSDK)/common/prizm_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      :=   MathAdd-In
BUILD      :=   build
SOURCES      :=   src
DATA      :=   data 
INCLUDES   :=

#---------------------------------------------------------------------------------
# options for code and add-in generation
#---------------------------------------------------------------------------------

MKG3AFLAGS := -n basic:Math Add-in -i uns:../unselected.bmp -i sel:../selected.bmp

CFLAGS   = -Os -Wall $(MACHDEP) $(INCLUDE) --std=c99
CXXFLAGS   =   $(CFLAGS)

LDFLAGS   = $(MACHDEP) -T$(FXCGSDK)/common/prizm.ld -Wl,-static -Wl,-gc-sections -std=c99

#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS   :=   -lfxcg -lgcc

#---------------------------------------------------------------------------------
# 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$(LIBFXCG_INC)

#---------------------------------------------------------------------------------
# build a list of library paths
#---------------------------------------------------------------------------------
export LIBPATHS   :=   $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
               -L$(LIBFXCG_LIB)

export OUTPUT   :=   $(CURDIR)/$(TARGET)
.PHONY: $(BUILD) clean

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

#---------------------------------------------------------------------------------
export CYGWIN := nodosfilewarning
clean:
   $(RM) -fr $(BUILD) $(OUTPUT).bin $(OUTPUT).g3a

#---------------------------------------------------------------------------------
else

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

#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).g3a: $(OUTPUT).bin
$(OUTPUT).bin: $(OFILES)


-include $(DEPENDS)

#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 3 of 4
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement