std: a namespace with this name does not exist

Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Mar 2007
Posts: 154
Reputation: mrjoli021 is an unknown quantity at this point 
Solved Threads: 0
mrjoli021 mrjoli021 is offline Offline
Junior Poster

std: a namespace with this name does not exist

 
0
  #1
Jan 7th, 2008
I am having some isues adding std as a namespace. I am using vs2008. don't know if that has something to do with it.

  1. #pragma once
  2.  
  3. //using namespace System;
  4. using namespace std;
  5.  
  6. namespace Email {
  7.  
  8. public ref class Class1
  9. {
  10.  
  11. private:
  12. void telnet ()
  13. {
  14. system("dir");
  15. }
  16.  
  17. };
  18. }

  1. #include "stdafx.h"
  2. #include "Email.h"
  3. #include <iostream>
  4. #include <fstream>
  5. #include <String>
  6. //#include <cstdio>
  7. //#include <stdlib.h>
  8.  
  9.  
  10. using namespace Email;
  11. //using namespace System;
  12. //using namespace std;
  13.  
  14. void main()
  15. {
  16. }
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 154
Reputation: mrjoli021 is an unknown quantity at this point 
Solved Threads: 0
mrjoli021 mrjoli021 is offline Offline
Junior Poster

Re: std: a namespace with this name does not exist

 
0
  #2
Jan 7th, 2008
I figured it out. when you do a class library std is replaced by system.
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 1,953
Reputation: Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of Duoas has much to be proud of 
Solved Threads: 214
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: std: a namespace with this name does not exist

 
0
  #3
Jan 7th, 2008
It most certainly does exist, and vs2008 is pretty darn standards-compliant.

Be careful about your capitalization. Also, you must include one of the STL headers to see it.

Try:
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. cout << "Hello world!" << endl;
  6. return EXIT_SUCCESS;
  7. }

However, you have changed the current scope by saying
using namespace Email;
You might want to try referring to it absolutely (not relatively):
using namespace ::std;

Hope this helps.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC