943,614 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Marked Solved
  • Views: 528
  • C++ RSS
Aug 10th, 2009
0

compiling in 64-bit mode

Expand Post »
I have this code:
C++ Syntax (Toggle Plain Text)
  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?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
dzhugashvili is offline Offline
35 posts
since Jun 2009
Aug 10th, 2009
0

Re: compiling in 64-bit mode

That compiler can not compile 64-bit programs. Either buy the Pro edition or use g++.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,947 posts
since Aug 2005
Aug 11th, 2009
0

Re: compiling in 64-bit mode

Last edited by Andrey_Karpov; Aug 11th, 2009 at 2:26 am.
Reputation Points: 46
Solved Threads: 3
Newbie Poster
Andrey_Karpov is offline Offline
7 posts
since Jul 2009
Aug 14th, 2009
0

Re: compiling in 64-bit mode

thank you.
Reputation Points: 10
Solved Threads: 0
Light Poster
dzhugashvili is offline Offline
35 posts
since Jun 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Virtual Inheritance Doubt
Next Thread in C++ Forum Timeline: C++ Callback Pointers help





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC