Questions tagged [redefinition]
276 questions
0
votes
1 answer
redefinition of 'WhatEver' as different kind of symbol
I'm trying to migrate some legacy code into a newer project and I don't really get this one fixed. The code compiled and worked well in the older environment.
I have a header file which contains these definitions:
std::string…

tamasgal
- 24,826
- 18
- 96
- 135
0
votes
2 answers
How to declare similar structure with different number of fields?
I have 2 headers that need to define 2 similar structures. One structure should be aligned to 32bytes and other is similar but doesn't need to align to 32bytes so I can save some memory here. One is included in the other. Here is…

Nishanth
- 43
- 6
0
votes
1 answer
Redefinition of C++ classes
I have this code which I CANNOT change:
A.h
class B;
class A
{
A();
void * getB();
private:
B * b;
}
A.cxx
namespace
{
class B : public QTabWidget
{
foo()
{
...
}
bar()
{
…

Mathieu Westphal
- 2,544
- 1
- 19
- 33
0
votes
1 answer
ADBannerView.h:20:8: Redefinition of 'NSString' as different kind of symbol
I get this error:
Redefinition of 'NSString' as different kind of symbol
at line:
extern NSString * const ADErrorDomain;
in ADBannerView.h
It used to work, has it something to do with Switching SDKs? from ios6 to ios7?

Mike Zriel
- 1,575
- 1
- 17
- 28
0
votes
3 answers
How to include a file only once / Prevent Function Redefinitions in old C API from C++ Program
I have a C++ program that HAS to use a C based API for a specific task. If I include only in to a single cpp in my program I have no problems at all. However if I include in to a header file (where I need to use some types) I get redefinition errors…

Ian Cant
- 403
- 3
- 11
0
votes
2 answers
Redifiniton of variable with a different type
I am getting the following error on Xcode: regarding my variable "in_code" and my class "Game_Object"
Redefinition of 'in_code' with a difference type 'Game_Object' vs 'char'
Here is my constructor for Person, another class
Person::Person(char…

user2998261
- 11
- 1
- 1
- 3
0
votes
3 answers
Redefiniton of an int error
I'm teaching my self C++ on the side and i realize this question may seem remedial to some. In the game I'm making as part of the learning process I want the user to be able to pick a difficulty and when they pick one or the other the random number…

Mark Vickery
- 15
- 5
0
votes
1 answer
how can i compile two or more lex file in my routine
now i want parse the php file, asp file or jsp file,
lex_php.l yacc_php.y is used to parse php file,
lex_asp.l yacc_asp.y is used to parse asp file,
then i have main, main will call different parse by input type
but when a compile and link them,…

user2570900
- 11
- 2
0
votes
4 answers
Redefinition of Class after Separating to .h/.cpp
I know this is a commonly asked question about C++ but following advice of other answers and such, I am still unable to get my seemingly simple code to work. My problem is the following code gives "error: redefinition of 'class…

ricky116
- 744
- 8
- 21
0
votes
1 answer
C++ Redefinition Error
I have searched for an answer to this question and tried the solutions suggested. Namely #pragma once and #ifndef/#endif. They haven't worked for me.
The problem I'm having is that every single function in my code is being defined multiple times. I…

user2359571
- 9
- 3
0
votes
1 answer
How should I deal with class redefinition errors in c++?
I am currently working on a c++ project after an absence and it seems that I have forgotten some syntax or method that would allow my code to compile correctly. After attempting to setup my environment, I am met with redefinition errors which I, of…
user968249
0
votes
5 answers
How to use operator+ and operator= together?
I have a little problem with 2 operators in my class.
My class is declared :
template
class MyMap{
keyType keys[MAX];
valueType values[MAX];
int size;
}
I need to redefine the operator [], for example…

Apaachee
- 900
- 2
- 10
- 32
0
votes
2 answers
Redefinition of class error
I am designing a program that takes three given points and calculates the fourth to create a parallelogram. What I have so far is:
struct Parallelogram : public Polygon {
Parallelogram(Point tl, Point tr, Point bl){
Point br;
int…

Robotguy27
- 25
- 5
0
votes
1 answer
Why Volatile Static Member Initialization Generate Redefinition Compilation Error?
My Problem is the following:
I have a class with static counter.
I set this counter as volatile because I use this variable in multithreaded environment.
class.h
class myClass
{
public:
volatile static int mCounter;
(...)
};
class.cpp
int…

Axel Borja
- 3,718
- 7
- 36
- 50
0
votes
3 answers
How to Protect Against Symbol Redefinition
My project incorporates a stack, which has a number of user-defined types (typedef). The problem is that many of these type definitions conflict with our in-house type definitions. That is, the same symbol name is being used. Is there any way to…

Jim Fell
- 13,750
- 36
- 127
- 202