I got a situation, I can't get a program compile since I splitted the files cause i thought it was too big.
Once the files is all merged in one, it works perfectly. Now that i splitted them, the compiler gives me the following error:
||=== Snake_Game, Debug ===|
D:ProjectsSnake_GameGraph_Funcs.c||In function 'snake_crashed':|
D:ProjectsSnake_GameGraph_Funcs.c|24|warning: 'textprintf_centre' is deprecated (declared at c:program files (x86)codeblocksmingwin../lib/gcc/mingw32/4.4.1/../../../../include/allegro/alcompat.h:178)|
D:ProjectsSnake_GameGraph_Funcs.c||In function 'read_string':|
D:ProjectsSnake_GameGraph_Funcs.c|91|warning: 'textout' is deprecated (declared at c:program files (x86)codeblocksmingwin../lib/gcc/mingw32/4.4.1/../../../../include/allegro/alcompat.h:157)|
D:ProjectsSnake_GameHighscore.c||In function 'set_hscore':|
D:ProjectsSnake_GameHighscore.c|30|warning: implicit declaration of function 'sort_scores'|
D:ProjectsSnake_GameMenus.c||In function 'option_menu':|
D:ProjectsSnake_GameMenus.c|114|warning: 'textprintf_centre' is deprecated (declared at c:program files (x86)codeblocksmingwin../lib/gcc/mingw32/4.4.1/../../../../include/allegro/alcompat.h:178)|
D:ProjectsSnake_GameMenus.c|115|warning: 'textprintf_centre' is deprecated (declared at c:program files (x86)codeblocksmingwin../lib/gcc/mingw32/4.4.1/../../../../include/allegro/alcompat.h:178)|
D:ProjectsSnake_GameMenus.c|116|warning: 'textprintf_centre' is deprecated (declared at c:program files (x86)codeblocksmingwin../lib/gcc/mingw32/4.4.1/../../../../include/allegro/alcompat.h:178)|
D:ProjectsSnake_GameMenus.c|117|warning: 'textprintf_centre' is deprecated (declared at c:program files (x86)codeblocksmingwin../lib/gcc/mingw32/4.4.1/../../../../include/allegro/alcompat.h:178)|
D:ProjectsSnake_GameMenus.c|118|warning: 'textprintf_centre' is deprecated (declared at c:program files (x86)codeblocksmingwin../lib/gcc/mingw32/4.4.1/../../../../include/allegro/alcompat.h:178)|
D:ProjectsSnake_GameGamePlay.c||In function 'game_play':|
D:ProjectsSnake_GameGamePlay.c|59|warning: 'textprintf_centre' is deprecated (declared at c:program files (x86)codeblocksmingwin../lib/gcc/mingw32/4.4.1/../../../../include/allegro/alcompat.h:178)|
objDebugHighscore.o||In function `check_hscore':|
D:ProjectsSnake_GameHighscore.c|13|multiple definition of `img_datafile'|
objDebugGraph_Funcs.o:c:program files (x86)codeblocksmingwin..libgccmingw324.4.1........includeallegroalcompat.h|32|first defined here|
objDebugHighscore.o||In function `check_hscore':|
D:ProjectsSnake_GameHighscore.c|14|multiple definition of `snd_datafile'|
objDebugGraph_Funcs.o:c:program files (x86)codeblocksmingwin..libgccmingw324.4.1........includeallegroalcompat.h|32|first defined here|
objDebugHighscore.o||In function `check_hscore':|
D:ProjectsSnake_GameHighscore.c|14|multiple definition of `fnt_datafile'|
objDebugGraph_Funcs.o:c:program files (x86)codeblocksmingwin..libgccmingw324.4.1........includeallegroalcompat.h|33|first defined here|
objDebugInit_Stuff.o||In function `init_allegro':|
D:ProjectsSnake_GameInit_Stuff.c|14|multiple definition of `img_datafile'|
objDebugGraph_Funcs.o:c:program files (x86)codeblocksmingwin..libgccmingw324.4.1........includeallegroalcompat.h|32|first defined here|
objDebugInit_Stuff.o||In function `init_allegro':|
D:ProjectsSnake_GameInit_Stuff.c|14|multiple definition of `snd_datafile'|
objDebugGraph_Funcs.o:c:program files (x86)codeblocksmingwin..libgccmingw324.4.1........includeallegroalcompat.h|32|first defined here|
objDebugInit_Stuff.o||In function `init_allegro':|
D:ProjectsSnake_GameInit_Stuff.c|15|multiple definition of `fnt_datafile'|
objDebugGraph_Funcs.o:c:program files (x86)codeblocksmingwin..libgccmingw324.4.1........includeallegroalcompat.h|33|first defined here|
objDebugMenus.o||In function `main_menu':|
D:ProjectsSnake_GameMenus.c|13|multiple definition of `img_datafile'|
objDebugGraph_Funcs.o:c:program files (x86)codeblocksmingwin..libgccmingw324.4.1........includeallegroalcompat.h|32|first defined here|
objDebugMenus.o||In function `main_menu':|
D:ProjectsSnake_GameMenus.c|13|multiple definition of `snd_datafile'|
objDebugGraph_Funcs.o:c:program files (x86)codeblocksmingwin..libgccmingw324.4.1........includeallegroalcompat.h|32|first defined here|
objDebugMenus.o||In function `main_menu':|
D:ProjectsSnake_GameMenus.c|14|multiple definition of `fnt_datafile'|
objDebugGraph_Funcs.o:c:program files (x86)codeblocksmingwin..libgccmingw324.4.1........includeallegroalcompat.h|33|first defined here|
objDebugmain.o||In function `mangled_main':|
D:ProjectsSnake_Gamemain.c|12|multiple definition of `img_datafile'|
objDebugGraph_Funcs.o:c:program files (x86)codeblocksmingwin..libgccmingw324.4.1........includeallegroalcompat.h|32|first defined here|
objDebugmain.o||In function `mangled_main':|
D:ProjectsSnake_Gamemain.c|12|multiple definition of `snd_datafile'|
objDebugGraph_Funcs.o:c:program files (x86)codeblocksmingwin..libgccmingw324.4.1........includeallegroalcompat.h|32|first defined here|
objDebugmain.o||In function `mangled_main':|
D:ProjectsSnake_Gamemain.c|13|multiple definition of `fnt_datafile'|
objDebugGraph_Funcs.o:c:program files (x86)codeblocksmingwin..libgccmingw324.4.1........includeallegroalcompat.h|33|first defined here|
objDebugAlgorithms.o||In function `qsort_helper_by_score':|
D:ProjectsSnake_GameAlgorithms.c|13|multiple definition of `img_datafile'|
objDebugGraph_Funcs.o:c:program files (x86)codeblocksmingwin..libgccmingw324.4.1........includeallegroalcompat.h|32|first defined here|
objDebugAlgorithms.o||In function `qsort_helper_by_score':|
D:ProjectsSnake_GameAlgorithms.c|14|multiple definition of `snd_datafile'|
objDebugGraph_Funcs.o:c:program files (x86)codeblocksmingwin..libgccmingw324.4.1........includeallegroalcompat.h|32|first defined here|
objDebugAlgorithms.o||In function `qsort_helper_by_score':|
D:ProjectsSnake_GameAlgorithms.c|14|multiple definition of `fnt_datafile'|
objDebugGraph_Funcs.o:c:program files (x86)codeblocksmingwin..libgccmingw324.4.1........includeallegroalcompat.h|33|first defined here|
objDebugGamePlay.o||In function `game_play':|
D:ProjectsSnake_GameGamePlay.c|13|multiple definition of `img_datafile'|
objDebugGraph_Funcs.o:c:program files (x86)codeblocksmingwin..libgccmingw324.4.1........includeallegroalcompat.h|32|first defined here|
objDebugGamePlay.o||In function `game_play':|
D:ProjectsSnake_GameGamePlay.c|13|multiple definition of `snd_datafile'|
objDebugGraph_Funcs.o:c:program files (x86)codeblocksmingwin..libgccmingw324.4.1........includeallegroalcompat.h|32|first defined here|
objDebugGamePlay.o||In function `game_play':|
D:ProjectsSnake_GameGamePlay.c|13|multiple definition of `fnt_datafile'|
objDebugGraph_Funcs.o:c:program files (x86)codeblocksmingwin..libgccmingw324.4.1........includeallegroalcompat.h|33|first defined here|
ld.exe||cannot find -lalleg|
||=== Build finished: 37 errors, 9 warnings (0 minutes, 1 seconds) ===|
This is driving me crazy. I can't get these to work when I split them.
And I find it a more organized thing, And I really wanna do it.
I'm dispose the files, so you guys can check out if you want.
Header main.h(the only header in the project. Although I had more than one for each .c file):
/**
Snake-Game:
A remake of the mobile game from nokia(don't know what model)
Made by Patrick Farias Bassut Souza <[email protected]
File: main.h
**/
#ifndef MAIN_H
#define MAIN_H
#include <stdio.h>
#include <stdlib.h>
#include <allegro.h>
#include <string.h>
#include <time.h>
#include "Images.h"
#include "Fonts.h"
#include "Sounds.h"
#define WINDOW_TITLE "Snake Game by Patrick Bassut"
#define VIDEO_CARD GFX_AUTODETECT_WINDOWED
#define MAX_X 800
#define MAX_Y 600
#define V_MAX_X 0
#define V_MAX_Y 0
#define COLOR_BITS 32
#define DIGI_CARD DIGI_AUTODETECT
#define MIDI_CARD MIDI_AUTODETECT
#define WHITE makecol(255, 255, 255)
#define BLACK makecol(0, 0, 0)
#define PINK makecol(255, 0, 255)
#define RED makecol(255, 0, 0)
#define BLUE makecol(0, 0, 255)
#define NORTH 0
#define EAST 1
#define SOUTH 2
#define WEST 3
#define LEFT_BORDER 18
#define RIGHT_BORDER 766
#define TOP_BORDER -13
#define BOTTOM_BORDER 577
#define WALL_COLLISION 0
#define ITSELF_COLLISION 1
#define FOOD_COLLISION 2
#define INIT_SPEED 200
#define START_TAILS 2
typedef enum{false, true}bool;
typedef struct _POS{
int x;
int y;
}Pos;
typedef struct _config{
int resolutionx;
int resolutiony;
bool window_mode;
bool changed;
bool music;
bool sound;
int volume;
}tConfig;
typedef struct _snake{
Pos pos;
int prev_snake_pos_x[400]; // Váriavel usada para 'guardar' os rastros X da snake.
int prev_snake_pos_y[400]; // Váriavel usada para 'guardar' os rastros Y da snake.
int tails_number;
int direction;
int speed;
}tSnake;
typedef struct _game{
tConfig cur_cfg;
Pos possible_food[24];
Pos food;
int food_type;
int points;
float speed_food_time;
Pos spr;
bool is_paused;
bool is_playing;
}tGame;
typedef struct _Score
{
int player_score;
char player_name[11];
}Score;
tSnake player;
tGame game;
DATAFILE *imggg_datafile = NULL;
DATAFILE *snd_datafile = NULL;
DATAFILE *fnt_datafile = NULL;
Score score_table[11];
int qsort_helper_by_score(const void *e1, const void *e2);
bool check_collision(int collision_type);
BITMAP *new_food();
inline void close_game();
void game_play();
void snake_crashed(int points);
void game_introduction();
void read_string(char *str_to, int x, int y, int size);
void fadein(BITMAP *bmp_orig, int speed, int until);
void fadeout(int speed, int until);
inline bool check_hscore(int points);
bool load_scores();
bool save_scores();
void show_hscore_list(char *name);
void set_hscore();
bool init_allegro();
bool init_game();
bool init_settings();
int main_menu();
void option_menu();
void apply_settings(tConfig new_config);
#endif
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…