Hallo Leute,
ich bin gerade dabei das Menü der Betty um ein paar eigene Punkte zu erweitern.
Um das Menüsystem zu verstehen, habe ich mir zuerst das testMenu kopiert und die Menüpunkte umbenannt (testMenuxx statt testMenu). In der Datei mainMenu.c habe ich in dem Menu Struct die folgende Zeile hinzugefügt:
{ 0, (void*)&testMenuxx, MENUENTRY, "Test", "Test" },
Wenn ich boop jetzt kompilieren will, bekomme ich eine dieser Fehlermeldungen:
gui/mainmenu.thumb.o:(.rodata+0x175a8): undefined reference to `testMenuxx'
error: 'testMenuxx' undeclared here (not in a function)
Ich dachte zuerst ich hätte vergessen die Kopie der testmenu.h zu includieren, habe ich aber nicht ...
Kann mir jemand von euch bei diesem Problem weiterhelfen?
Gruß JD
P.S. Was hat es eigentlich mit den Direktiven auf sich?
#ifndef TESTMENU_H
#define TESTMENU_H
extern struct MENU testMenu;
#endif
Ich kann die Methoden von schon vorhandenen Dateien ändern und es wird kompiliert.
Nur wenn ich eine eigene Datei hinzufüge bekomme ich boop nicht mehr kompiliert.
Das ist meine mainmenu.c
#include "menu.h"
#include "testmenu.h"
#include "gamesmenu.h"
#include "moodpxlmenu.h"
#include "settingsmenu.h"
#include "toolsmenu.h"
#include "lcd.h"
#include "fonty.h"
#include "keyboard.h"
#include "global.h"
#include "flash.h"
#ifndef DEBUGMODE
#include "sounds.h"
#include "sound3.h"
#include "sound.h"
#endif
unsigned int testdata1, testdata2;
void show_info(void) {
unsigned short flashID;
unsigned short hwID;
flashID = getFlashID();
draw_hexC (0, 30, flashID, LCD_COLOR_B, DRAW_PUT);
hwID = GetHWversion();
draw_hexS (0, 38, hwID, LCD_COLOR_B, DRAW_PUT);
lcd_fill(0);
set_font(BOLDFONT);
draw_string (0,0,"Info", LCD_COLOR_B, DRAW_PUT);
set_font(SMALLFONT);
draw_string(0,14,"Flash \n"
"Manuf. ID\n"
"Device ID\n"
"\n"
"Betty\n"
"HW Version\n", LCD_COLOR_B, DRAW_PUT);
draw_hexC (65, 23, (flashID>>8), LCD_COLOR_B, DRAW_PUT);
draw_hexC (65, 32, (flashID&0x00ff), LCD_COLOR_B, DRAW_PUT);
draw_hexC (65, 59, (unsigned char)hwID, LCD_COLOR_B, DRAW_PUT);
draw_string (0,77,"Boop", LCD_COLOR_B, DRAW_PUT);
#ifdef RELEASE
// draw_numU (65,86,SVNVERSION+1,0, LCD_COLOR_B, DRAW_PUT);
draw_string (0,86,"SVN Release", LCD_COLOR_B, DRAW_PUT);
#else
//draw_numU (65,86,SVNVERSION,0, LCD_COLOR_B, DRAW_PUT);
draw_string (0,86,"SVN Revision", LCD_COLOR_B, DRAW_PUT);
#endif
draw_string (0,95,__DATE__, LCD_COLOR_B, DRAW_PUT);
draw_string (0,104,__TIME__, LCD_COLOR_B, DRAW_PUT);
set_font(SMALLFONT);
waitKeyUpDown();
} // show_info
void show_credits(void)
{
lcd_fill(0);
set_font(BOLDFONT);
draw_string (0,0,"Credits", LCD_COLOR_B, DRAW_PUT);
set_font(SMALLFONT);
draw_string (0,14,"Netguy\tBasics\n"
"Telekatz\tBasics, IR/RF\n"
"Theborg\tFirst Steps, HW\n"
"Colibri\tFlash SW\n"
"Damaltor\tSupport\n"
"Pr0nbug\tFirst Steps\n"
"Asgart\tForum/Wiki\n"
"Spessi\tSurport, HW", LCD_COLOR_B, DRAW_PUT);
draw_string(0,95,"Und alle Anderen\n"
"die vergessen wurden.", LCD_COLOR_B, DRAW_PUT);
draw_string(0,120,"Thanks to Max Fleischer\n"
"for a great Cartoon!", LCD_COLOR_B, DRAW_PUT);
set_font(BOLDFONT);
draw_string (8,150,"www.bettyhacks.com", LCD_COLOR_B, DRAW_PUT);
set_font(SMALLFONT);
#ifndef DEBUGMODE
playSound((unsigned char*)sound1_data, sound1_len);
waitSound();
playSound((unsigned char*)sound2_data, sound2_len);
waitSound();
#endif
waitKeyUpDown();
} // show_credits
const struct MENU_ENTRY mainMenuEntries[] =
{
{ 0, (void*)&moodpxlMenu, MENUENTRY, "MoodPxl", "Turn it on!" },
{ 0, (void*)&testMenu, MENUENTRY, "TestStuff", "Various tests" },
{ enter_settings_menu, 0, FUNCENTRY, "Settings", "Change settings" },
{ 0, (void*)&toolsMenu, MENUENTRY, "Tools", "Tools" },
{ show_credits, 0, FUNCENTRY, "Credits", "Show Credits" },
{ show_info, 0, FUNCENTRY, "Info", "Show Info" }
};
const struct MENU mainMenu =
{
NUM_OF_ELEMENTS (mainMenuEntries), (MENU_ENTRY*)&mainMenuEntries, "Main Menu"
};
Die moodpxl.c Datei befindet sich im selben Verzeichnis. Sie ist eine einfache Kopie der gamesmenu.c
#include "menu.h"
#include "tic_tac_toe.h"
#include "sokoban.h"
#include "connect4.h"
const struct MENU_ENTRY moodpxlMenuEntries[] =
{
{ &GameTicTacToe, 0, FUNCENTRY, "TicTacToe", "Play TicTacToe" },
{ &GameSokoban, 0, FUNCENTRY, "Sokoban", "Play Sokoban" },
{ &start_connect4, 0, FUNCENTRY, "Connect4", "Play Connect4" }
};
const struct MENU moodpxlMenu =
{
3, (MENU_ENTRY*)&moodpxlMenuEntries, "Games"
};
Zum Schluss noch die moodpxlmenu.h
#ifndef MOODPXLMENU_H
#define MOODPXLMENU_H
extern const struct MENU moodpxlMenu;
#endif
Beim kompilieren meckert mir der Linker folgendes an:
thumb.o:(.rodata+0x17594): undefined reference to `moodpxlMenu'
Ich bin echt ahnungslos.
Hast du die entsprechende make.conf auch angepasst und deine moodpxl.c dort eingetragen?
In meiner Make.conf gibt es nur zwei Zeilen. EIne mit den Subdirs und eine mit den SRCs. In der SRC-Zeile sind nur crt.c main.c global.c und buffer.c eingetragen.
Wo soll ich da meine Datei hinzufügen?
Gruß JD
Eine make.conf gibt es in jedem Verzeichniss mit .c Dateien. In deinem Fall \boop\trunk\gui\make.conf:
THUMBSRCS := menu.c mainmenu.c testmenu.c settingsmenu.c controls.c moodpxl.c
Oh man ....
Jetzt wird mir das langsam peinlich ... Vielen Dank!