471,337 Members | 1,068 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

Error C2143 missing ';' before '*' and others

Here is my code where I am receiving the error:
Expand|Select|Wrap|Line Numbers
  1. #include <fstream>
  2. #include "BinaryTree.h"
  3. using namespace std;
  4.  
  5. Node* BinaryTree::MakeTree(ifstream& infile)
  6. {
  7.     char name;
  8.     infile>>name;
  9.     Node* base = new Node(name);    
  10.     return base;
  11. }
  12.  
And here are the errors that I receive:

error C2143: syntax error : missing ';' before '*' //this error occurs on line 5

error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

error C2556: 'int *BinaryTree::MakeTree(std::ifstream &)' : overloaded function differs only by return type from 'BinaryTree::Node *BinaryTree::MakeTree(std::ifstream &)

error C2371: 'BinaryTree::MakeTree' : redefinition; different basic types

error C2264: 'BinaryTree::MakeTree' : error in function definition or declaration; function not called


I assumed that the first error probably meant there was a missing semicolon somewhere in my BinaryTree.h file, but i have checked over it thoroughly and can't find see any place that it is missing. It doesn't make sense to me either that it wants a semicolon after "Node". It is just really weird!

I can provide my BinaryTree.h file if anyone wants to look at it.
Sep 4 '07 #1
2 5518
mac11
256 100+
Here is my code where I am receiving the error:
I can provide my BinaryTree.h file if anyone wants to look at it.
yes - please post your .h file - but (shot in the dark), did you forget the ';' at the end of your class definition?
Expand|Select|Wrap|Line Numbers
  1. class whatever
  2. {
  3. ... class members and such...
  4. };   // <---- this one 
Sep 4 '07 #2
RRick
463 Expert 256MB
The compiler doesn't know who Node is. Check for Node in the header file. Is Node defined? Does Node reside in a namespace?
Sep 4 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Andrew Luke | last post: by
reply views Thread by Shashikiran Prabhakar via .NET 247 | last post: by
18 posts views Thread by George2 | last post: by
3 posts views Thread by sphenxes | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.