[C++] - Error C1004: unexpected end-of-file found

Associate
Joined
28 Jul 2014
Posts
694
Location
Liverpool
I am in the middle of programming a Train Seat Reservation program, could anybody help me out with this error I am getting when trying to compile and run my code the code I get is:

Error 4 error C1004: unexpected end-of-file found

I have looked everywhere online and the only possible fix is to change the linker to console, but it don't work. Others are saying it could be a missing semi-colon that I have not put after a closing bracket.

Any help would be much appreciated, thanks!

http://codepad.org/YZcYukpX

*Could somebody move this to the HTML & Programming section, posted here by accident sorry.
 
Last edited:
Soldato
Joined
20 Dec 2004
Posts
16,021
Not sure this is the right forum for this but try removing the comma from end of line 17.

Probably that.

Gawd I don't miss doing this stuff at uni. Soon you'll be able to use the tools people in the real world use though, don't give up ;)
 
Caporegime
Joined
18 Oct 2002
Posts
32,623
Also try to get rid of those C-style arrays and use vectors, and for arrays of chars use a string. Much more maintainable then.
 
Soldato
Joined
6 Sep 2006
Posts
6,296
Location
London
Probably that.

Gawd I don't miss doing this stuff at uni. Soon you'll be able to use the tools people in the real world use though, don't give up ;)

C++ is by far my favourite language to use and is what a lot of the professional world uses. Unless he ends up just doing front end web development then he'll probably (hopefully) get to use C++.

And yes, what D.P. says, please use the tools that are at your disposal, you're using C++ as if you're living in the 90s. The STL exists for a very good reason, it's to make the code you're writing ten times easier to code and read.
 
Associate
Joined
16 Aug 2010
Posts
1,373
Location
UK
Is, but becoming more "was" my favourite language too. Have to admit I'm getting more and more in love with C# as time goes by. A few years ago I wouldn't have touched it, I was all about the c++ :p.

I'd also echo the above post and take a look at the C+11/14 features potentially. They make aspects nicer to use and worth learning.
 
Man of Honour
Joined
13 Oct 2006
Posts
92,042
Also try to get rid of those C-style arrays and use vectors, and for arrays of chars use a string. Much more maintainable then.

Non-functional code quickly done off the top of my head so it might not make any sense at all but I always kind of liked this kind of technique for handling stuff like that:

Code:
typedef struct
{
	char	*entry;
} items_t;

items_t items[]= {
	{"entry 1"],
	{"entry 2"],
	{"entry 3"],
	{NULL}
};

items_t	*item

for (item=items ; item->entry ; item++)
{
// do something with each item
}

Pretty much endlessly expandable and self contained.
 
Soldato
Joined
20 Dec 2004
Posts
16,021
Ehh, I use C++, as do all my colleagues.

So do I (game dev). What I meant was he will be able to use proper modern C++ tools to get things done instead of slogging through the same curriculum most schools/universities have been teach since the 90s.
 
Back
Top Bottom