-
Namespace name expected
Just wondering if you guys can help with this:
#include <iostream>
#include <cstring>
#include <stdlib>
using namespace std;
....
This is what I have in my header. When I try to compile, the "Namespace name expected" error pops up. Eventhough I clearly have it in there. Oh yes, this code compiles correctly on the Unix systems at school but does not compile on my home puter which is running Borlandv5.02 and Windows. Any ideas anybody.
-
Does Borland 5.02 support that or is it pre-1998? I've never used Borland, and thats the only reason I can think of as to why that wouldn't work..
-
is that the free command line version? if so did you set the enviornment variables like the readme.txt file said?
-
If it is standard C++ compliant <stdlib> should be <cstdlib> so:
Code:
#include <iostream>
#include <cstring>
#include <cstdlib>
using namespace std;
Try this.
Mr. C.
-
thanks alot guys for the help. I ran the code under MS Visual C++ and it works perfectly. I didn't try to solve the problem in Borland instead just went straight to Visual C++. Mr C i did try using the cstdlib header as well and it still didn't work.
-
Using Borland C++ 5.02, (the GUI version), and having the same issue.
Very frustrating.
-
Welcome to the boards. If you haven't already done so then please take some time to familiarise yourself with the faq:
http://faq.cprogramming.com/cgi-bin/smartfaq.cgi
Make sure you have a look at the the posting guidelines:
http://cboard.cprogramming.com/annou...ouncementid=51
Following the rules will ensure you get a prompt answer to your question.
Remember, too, that the board has a search facility, a link is at the top of your screen:
http://cboard.cprogramming.com/search.php
It will often get you a quicker answer to your questions than waiting for a response to one you have posted.
If you have any questions about this you may ask or you can contact one of our forum leaders:
http://cboard.cprogramming.com/showgroups.php
--------------------------------------------
In this case, it looks like you were able to search for a similar problem, but it would be better to start a new thread and link to the one you find rather than bumping the old thread.
Borland 5.02 appears to be a very old compiler that probably doesn't support modern, standard C++ (and in this case namespaces). Consider using a different compiler. There are several free IDEs available that come with good modern compilers (e.g. VC++ Express, Dev-C++, Code::Blocks).
-
I just thought I'd respond to it as I've recently joined a software compay with a huge project that will likely never been updated to run properly with other compilers, (it's pretty dodgy), but figured there might be others in a similar boat.
Incidentally, I found some information with regards to it:
http://tisue.net/cs311/fall-00/notes/borland-notes.html
It appears you can just comment out the 'using namespace std;' line.