Enumeration trouble: redeclared as different kind of symbol
Posted
by
Matt
on Stack Overflow
See other posts from Stack Overflow
or by Matt
Published on 2011-02-05T23:08:50Z
Indexed on
2011/02/05
23:25 UTC
Read the original article
Hit count: 230
Hello all. I am writing a program that is supposed to help me learn about enumeration data types in C++. The current trouble is that the compiler doesn't like my enum usage when trying to use the new data type as I would other data types. I am getting the error "redeclared as different kind of symbol" when compiling my trangleShape function. Take a look at the relevant code. Any insight is appreciated! Thanks!
(All functions are their own .cpp files.)
header file
#ifndef HEADER_H_INCLUDED
#define HEADER_H_INCLUDED
#include <iostream>
#include <iomanip>
using namespace std;
enum triangleType {noTriangle, scalene, isoceles, equilateral};
//prototypes
void extern input(float&, float&, float&);
triangleType extern triangleShape(float, float, float);
/*void extern output (float, float, float);*/
void extern myLabel(const char *, const char *);
#endif // HEADER_H_INCLUDED
main function
//8.1 main
// this progam...
#include "header.h"
int main()
{
float sideLength1, sideLength2, sideLength3;
char response;
do //main loop
{
input (sideLength1, sideLength2, sideLength3);
triangleShape (sideLength1, sideLength2, sideLength3);
//output (sideLength1, sideLength2, sideLength3);
cout << "\nAny more triangles to analyze? (y,n) ";
cin >> response;
}
while (response == 'Y' || response == 'y');
myLabel ("8.1", "2/11/2011");
return 0;
}
triangleShape shape
# include "header.h"
triangleType triangleShape(sideLenght1, sideLength2, sideLength3)
{
triangleType triangle;
return triangle;
}
© Stack Overflow or respective owner