compiling in 64-bit mode

Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Jun 2009
Posts: 33
Reputation: dzhugashvili is an unknown quantity at this point 
Solved Threads: 0
dzhugashvili dzhugashvili is offline Offline
Light Poster

compiling in 64-bit mode

 
0
  #1
Aug 10th, 2009
I have this code:
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include <algorithm>
  5. #include <fstream>
  6. #include <stdlib.h>//(for atoi to work)
  7.  
  8. using namespace std;
  9.  
  10. void usage()
  11. {
  12. cout << "Usage: <input1> <input2> <output>\n";
  13. cout << "\n see README for more details.\n";
  14. exit(1);
  15. }
  16.  
  17. int main(int argc, char *argv[])
  18. {
  19. cout << "\nshmoosh - concatenates and uniques wordlists into one\n";
  20.  
  21. if(argc!=4)
  22. usage();
  23.  
  24. vector<string> vec_wordlist_compilation;
  25.  
  26. ///////////////////////////input1//////////////////////////////
  27.  
  28. ifstream wordlistfile(argv[1]);
  29. if(!wordlistfile.is_open())
  30. {
  31. cout<<"\nError opening file \'"<<argv[1]<<"\'\n";
  32. exit(1);
  33. }
  34. int x=0;
  35. string word;
  36. while(getline(wordlistfile,word)){
  37. vec_wordlist_compilation.push_back(word);
  38. x++;
  39. }
  40. cout << x << " words loaded from file \'"<<argv[1]<<"\'\n";
  41.  
  42. wordlistfile.close();
  43.  
  44. ///////////////////////////input2//////////////////////////////
  45.  
  46. ifstream wordlistfiletwo(argv[2]);
  47. if(!wordlistfiletwo.is_open())
  48. {
  49. cout<<"\nError opening file \'"<<argv[2]<<"\'\n";
  50. exit(1);
  51. }
  52. int v=0;
  53. while(getline(wordlistfiletwo,word)){
  54. vec_wordlist_compilation.push_back(word);
  55. v++;
  56. }
  57. cout << v << " words loaded from file \'"<<argv[2]<<"\'\n";
  58.  
  59. wordlistfiletwo.close();
  60.  
  61. ////////////////////////////sort//////////////////////////////
  62. cout << "\nsorting " << v+x << " words, removing duplicates...\n";
  63.  
  64. //sort vector (least to greatest)...
  65. sort(vec_wordlist_compilation.begin(),vec_wordlist_compilation.end());
  66. //remove duplicates...
  67.  
  68.  
  69. vec_wordlist_compilation.resize((unique(vec_wordlist_compilation.begin(),vec_wordlist_compilation.end()))-vec_wordlist_compil
  70.  
  71. ation.begin());
  72.  
  73. /*for(unsigned int c=0;c<vec_wordlist_compilation.size();c++)
  74. cout << vec_wordlist_compilation[c] << "\n";*/
  75. cout << vec_wordlist_compilation.size() << " unique words remain.\n";
  76.  
  77. ////////////////////////////output//////////////////////////////
  78.  
  79. ofstream output(argv[3]);
  80. for(unsigned int c=0;c<vec_wordlist_compilation.size();c++)
  81. output << vec_wordlist_compilation[c] << "\n";
  82.  
  83. return 0;
  84. }

the problem is, when I compile it in 32-bit mode, it can only access 2GB of my 8GB of RAM, so it can only work with small wordlists. Does anybody know if there is a simple way I can reconfigure my compiler (Microsoft Visual C++ 2008 Express Edition) to compile this code in 64-bit mode, enabling it to access all of my RAM? Or would I actually have to modify the code?
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,679
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1504
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: compiling in 64-bit mode

 
0
  #2
Aug 10th, 2009
That compiler can not compile 64-bit programs. Either buy the Pro edition or use g++.
I told Santa what I wanted for Christmas and he washed my mouth out with soap.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 3
Reputation: Andrey_Karpov is on a distinguished road 
Solved Threads: 2
Andrey_Karpov Andrey_Karpov is offline Offline
Newbie Poster

Re: compiling in 64-bit mode

 
0
  #3
Aug 11th, 2009
Last edited by Andrey_Karpov; Aug 11th, 2009 at 2:26 am.
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 33
Reputation: dzhugashvili is an unknown quantity at this point 
Solved Threads: 0
dzhugashvili dzhugashvili is offline Offline
Light Poster

Re: compiling in 64-bit mode

 
0
  #4
Aug 14th, 2009
thank you.
Reply With Quote Quick reply to this message  
Reply

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



Similar Threads
Other Threads in the C++ Forum


Views: 384 | Replies: 3
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC