Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Am I an idiot?

Status
Not open for further replies.

michaelkrauklis

Programmer
Dec 5, 2001
226
US
I've been programming in C++ for years but I've never used Visual C++. We have it at work so it's what i have to use now. I'm trying to create the framework for a somewhat complicated program, but right now I'm at the infancy stages. I'm just trying things out, but I can't even get the thing to make a simple console application. I craeted the new project, and as far as I can tell all my syntax is correct, but when I try to compile it gives me all sorts of errors. eg:

d:\paradoxtest\mike\paradoxtosql\row.h(8) : error C2236: unexpected 'class' 'Row'

d:\paradoxtest\mike\paradoxtosql\row.h(8) : error C2143: syntax error : missing ';' before ':'

d:\program files\microsoft visual studio\vc98\include\iostream.h(50) : error C2628: 'Table' followed by 'long' is illegal (did you forget a ';'?)

d:\program files\microsoft visual studio\vc98\include\streamb.h(65) : error C2371: 'streampos' : redefinition; different basic types

etc...

I get a bunch of those types of errors, but if you notice the last two are in the standard library Iostream. I haven't changed anything in IOstream so there's a compilation error in their code?? And I don't think there's anything wrong with my code. I there anything special you need to do to compile? Help Please!!! thanks MYenigmaSELF
myenigmaself@yahoo.com
 
I was just where you are right now a year ago. The best advice i can give you is to pick up a book on VC++ programming and go through couple of examples. It cleared a lot of questions for me. I the book that used was Beginning MFC Programming by Ivor Norton. Any book store should have it.
Good luck.
 
Thanks, but I've already got books out the wazoo. The problem is I don't know what's wrong so I don't know where to look in the books. VC++ syntax is the same as standard C++, is it not?

Row.cpp
//****************************
#include "Row.h"

Row::Row()
:CObject(),
nodes(new CStringList())
{

}

bool Row::addNode(Cstring* node){
bool ret_fal=true;
try{
nodes->AddTail(node);
}
catch (CMemoryException* e){
ret_val=false;
}

return ret_val;
}


Row.h
//****************************
#ifndef ROW_H
#define ROW_H


#include <afxcoll.h>//for CObList and CStringList
#include <afx.h>//for CString and CObject

class Row : public CObject{

public:
Row();
bool addNode(CString *node);

private:
CStringList *nodes;


}


#endif

That gives me a slu of errors. Even simply including <iostream.h> in my main .cpp file gave me errors. Is VCpp that much different??? I'm very confused, but thanks for the help. MYenigmaSELF
myenigmaself@yahoo.com
 
Something that may point you in the right direction is to use MSDN to search for each error code you're getting. Hit F1 any time to bring up the help database, select the Search tab, and type in &quot;error C2236&quot;. That should bring up all the possible causes and some solutions to that particular error. I looked up C2236 and it says &quot;The specified identifier was already defined as a type and cannot be overridden by another user-defined type&quot;. Maybe try a different name for your Row class? I don't know about other compilers, but VC++ will complain about a lot of things when only one problem exists.

Hope that helps!

~Mike
Any man willing to sacrifice liberty for security deserves neither liberty nor security.

-Ben Franklin
 
Thanks to the both of you. Answer to the question, &quot;Am I an Idiot?&quot; A qualified yes. It was stupid syntax error that was bringing up all those other errors. I forgot to put a ';' at the end of each of my class stubs. I haven't programmed in C++, at laest not object oriented programming, in a year and a half and I've gotten a little bit used to the Java syntax. Maybe a little too used to it. But thanks again to the both of you for your help. Yes, I am an idiot=) MYenigmaSELF
myenigmaself@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top