 |
| C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|

December 16th, 2005, 12:56 PM
|
|
Authorized User
|
|
Join Date: Dec 2005
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
P.S
I will help my collegue with the information provided, thanks for your advice, but as my knowledge of programming is quite weak, i am unable to write the rest of the program as i do not understand the c++ language thoughraly, i think i might just give up, Thank you all for your advice and help, it is much appreciated and has helped quite alot... look forward to keeping updated with this website as i know i can learn alot from here...
Thanks again...
Nicolas
|

December 16th, 2005, 01:08 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 453
Thanks: 0
Thanked 1 Time in 1 Post
|
|
The program would compile just do these three things
1 Delete or comment out the first main- including the curly brace following it
2 in the search book function, delete the curly brace after the line
struct books_t;
3 replace
int main()
with
void main()
Regards
Ankur Verma
|

December 16th, 2005, 01:40 PM
|
|
Authorized User
|
|
Join Date: Dec 2005
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I have made the adjustments advised and i am still recieving a compilation error. These are the errors i am recieving:
test1.cc:252: error: `main' must return `int'
test1.cc: In function `int main(...)':
test1.cc:255: error: `books_t' undeclared (first use this function)
test1.cc:255: error: (Each undeclared identifier is reported only once for each function it appears in.)
test1.cc:255: error: expected `;' before "abook"
test1.cc:256: error: `pbook' undeclared (first use this function)
test1.cc:257: error: `abook' undeclared (first use this function)
test1.cc:263: error: invalid use of undefined type `struct std::stringstream'
/usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/../../../../include/c++/3.4.3/iosfwd:84: error: declaration of `struct std::stringstream'
test1.cc: In function `int main()':
test1.cc:274: error: declaration of C function `int main()' conflicts with
test1.cc:252: error: previous declaration `int main(...)' here
|

December 16th, 2005, 04:27 PM
|
|
Authorized User
|
|
Join Date: Nov 2005
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
replace int main with void main....what where did u learn that...was not expected from a moderator
|

December 17th, 2005, 03:07 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 453
Thanks: 0
Thanked 1 Time in 1 Post
|
|
The ANSI standards donât require a program with main returning anything else other
than an int, including void, to fail.
But certainly, programs with main not returning an int are unsafe and their behavior
is unreliable should anything goes wrong.
'void main' however, certainly removes a few errors for a person who is not bothered
about whatâs right and whatâs wrong and just trying tooth and nail to get his program
to compile at all- so many books these days show program with main returning void, and
many compiler wont even flag a warning on that, but the fact remains that âvoid mainâ
is incorrect.
I gather that is what you were trying to say with your query -âwhere did u learn thatâ
and not asking me the name of the university I went to, right SunnyPal?
Thanks for pointing that out.
Well, when I see something I donât agree with in a post, I just post my point of view on
that with what I think is the corrected version of the info in the post. I find that more
constructive. But thatâs me.
People who are well informed, are always welcome to this forum.
If they could help others as well
- better yet.
Regards
Ankur Verma
|

December 17th, 2005, 05:19 PM
|
|
Authorized User
|
|
Join Date: Dec 2005
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks for your help guys... but after applying the what you told me, the program is still not compiling. My deadline is on monday and the only thing i can do now is submit the program how it is and hope for the best.
Once again your help was much apprecited.
Sorry for any inconvenience..
Regards
Nicolas.
|

December 18th, 2005, 09:48 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 453
Thanks: 0
Thanked 1 Time in 1 Post
|
|
You are welcome Nicolas, and I would say that your program didnât have anything seriously wrong about it. The problems were more of those trivial syntactical typos that every beginner makes, a part of learning curve, and quite easy to get by with a little practice.
But let me tell you that if you have written this code yourself, youâve done a pretty good job for a beginner and you deserve a pat on your back for that.
Regards
Ankur Verma
|
|
 |