how to solve the redefinition error in c++

49 views Asked by At

For some reason when i run a c++ program with special characters they are not displayed as they should, so i made this header file:

#ifndef Tildes_h
#define Tildes_h

unsigned char a_con_tilde = 160;
unsigned char a_may_con_tilde = 181;
unsigned char e_con_tilde = 130;
unsigned char e_may_con_tilde = 144;
unsigned char i_con_tilde = 161;
unsigned char i_may_con_tilde = 214;
unsigned char o_con_tilde = 162;
unsigned char o_may_con_tilde = 224;
unsigned char u_con_tilde = 163;
unsigned char u_may_con_tilde = 233;
unsigned char enie =164;
unsigned char enie_may =165;
unsigned char u_con_dieresis = 129;
unsigned char u_may_con_dieresis = 154;
unsigned char numero = 167;

#endif

it works correctly when i use it in one cpp file:

// invertebrado.cpp

#include "animal.h" // base class
#include "terrestre.h" //derived class
#include "invertebrado.h" //the derived class im working on
#include "tildes.h" // the problematic header

but i get the redefinition error when i use the header in another cpp file simultaneously:

// vertebrado.cpp

#include "animal.h" //base class
#include "terrestre.h" //derived class
#include "vertebrado.h" //other derived class im working on
#include "tildes.h" //the problematic header

multiple definition....... first defined here

i ve tried moving the header to the parent classes files but it still doesnt work

0

There are 0 answers