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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Visual c++ gets stuck 1

Status
Not open for further replies.

fugigoose

Programmer
Jun 20, 2001
241
US
My visual c++ 6.0 is getting stuck after a build. It compiles everything (and returns error messages when I'm bad), but then it will not let me exit or build again. It says "you cannnot exit with a build in progress. Choose the command 'stop build'". However, no matter how many times i click "stop build" it doesnt stop build. I have to ctr + alt + delete it to close visual c++. Thanx. Also, on a side note, what do i need to include to use cin, i keep having problems with cin being an "undeclared identifier". I've used plenty of DX8 and windows API but i've never used cin, so i'm a cin noob, go figure!
 
I used to have that problem. Try downloading the newest service pack from MSDN; I did and I don't remember having any problems afterwords.

To get cin, you generally use the following code:
#include <iostream>
using namespace std;

People say it's bad practice to say "using namespace std" instead of saying "using std::cin", but it's a lot less of a hassle this way and it has never caused a problem for me.
 
using namespace std;" is like dumping the largest box of crayons Crayola makes in order to use the Black one. =-)
 
It's a lot quicker and easier to dump out a box of 500 crayons and ignore the ones you don't use than to take out 50 crayons one at a time. If I said "using std::whatever" for every part of STL I use, I would have at least a page full of them. Why waste the effort when it doesn't make one bit of difference?
 
The difference it that it avoids the possibility of naming conflicts. But I would agree that if you are using that many elements from the std namespace, it might be easier to just say "using namespace std;" and just try not to use names that were declared in std for your functions and variable names...
 
If you use global variables, you should be using a g_ prefix, and STL doesn't use that, so there is no possibility of naming conflicts there. For global functions you should be using pascal casing, and STL uses pretty much all lower case letters, so there is no possibility of conflict there either. Since coding conventions were different when STL was released, I don't think there's a problem. I've never had a name conflict come up and I haven't even had to think about trying to avoid them.
 
I've never had a problem either. I use my own modified Hungarian notation. Other people I know are EXTREMELY opposed to it and use variable names like "string", which could definitely conflict. But that's their problem. ;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top