title: Entry point not found when running exe - C++
body: <p>I'm trying to run an exe containing C++ code, but it keeps giving me an "entry point not found" error.</p>
  
  <p>To start off with, this is a homework assignment based on the solution to an earlier assignment. I compiled that as it was and tried to run the resulting exe, but I got the same issue.</p>
  
  <p>Below is the code that I downloaded.</p>
  
  <pre><code>#include &lt;iostream&gt; //for cout, cin
  #include &lt;iomanip&gt; // for setw, fixed, setprecision() manipulators
  #include &lt;fstream&gt; //for file input/output
  #include &lt;string.h&gt; //for string types usage
  #include &lt;cstdlib&gt;
  using namespace std;
  
  /*
  Structure to store the date
  */
  struct Date
  {
  int month;
  int day;
  int year;
  };
  
  /*
  Structure to store Vehicle Options
  */
  struct Option
  {
  string seatMaterial;
  int wheelSize;
  string stereo;
  string winterPackage;
  };
  
  /*
  Structure to store Vehicles data
  */
  struct Vehicle
  {
  int ID;
  string name;
  int cylinder;
  string trans;
  
  Date manufDate;
  Date shipDate;
  
  Option vehicleOptions;
  
  char receiverFlag; // I or D
  
  //for individuals
  string ind_first, ind_last, ind_address;
  
  //for dealers
  int deal_zip;
  
  
  };
  
  Vehicle* readVehicleFromFile(int &amp;totalVehicles);
  void menu(Vehicle *vehicle, int totalVehicle);
  void printHorizontalLine(int width, char border_char );
  void printVehicle(Vehicle *vehicle, int totalVehicle, char flags);
  
  /*
  * Entry point
  */
  int main()
  {
  Vehicle *allVehicle;
  int totalVehicle = 0;
  allVehicle = readVehicleFromFile(totalVehicle);
  
  if( allVehicle == NULL )
  {
      cout &lt;&lt; "allVehicle is NULL" &lt;&lt; endl;
      return 0;
  }
  
  printVehicle(allVehicle, totalVehicle, ' ');
  menu(allVehicle, totalVehicle);
  
  return 0;
  }
  
  
  
  /*
  * Responsible for reading Vehicle records from vehicles.txt into Vehicle     array of structs
  *
  *
  * @param totalVehicle: reference variable which post execution, contains size of Vehicle
  * @param return: pointer pointing to the array of structs containing Vehicle data
  */
  Vehicle* readVehicleFromFile(int &amp;totalVehicle)
  {
  char delimiter;
  Vehicle *allVehiclePointer;
  //input stream for Vehicle data
  ifstream allVehicleInFile;
  
  //open Vehicles file
  allVehicleInFile.open("vehicles.txt");
  
  //error handling in case file does not exist - start
  if( !allVehicleInFile )
  {
      cout &lt;&lt; "Error opening vehicles.txt" &lt;&lt; endl;
      return NULL;
  }
  //error handling in case file does not exist - end
  cout &lt;&lt; "Success opening vehicles.txt" &lt;&lt; endl;
  allVehicleInFile &gt;&gt; totalVehicle;
  allVehiclePointer = new Vehicle[totalVehicle];
  
  cout &lt;&lt; "totalVehicles: " &lt;&lt; totalVehicle &lt;&lt; endl;
  
  for(int i = 0; i &lt; totalVehicle; i++)
  {
      allVehicleInFile &gt;&gt; allVehiclePointer[i].ID;
      allVehicleInFile &gt;&gt; allVehiclePointer[i].name;
      allVehicleInFile &gt;&gt; allVehiclePointer[i].cylinder;
      allVehicleInFile &gt;&gt; allVehiclePointer[i].trans;
      //get dates
      allVehicleInFile &gt;&gt; allVehiclePointer[i].manufDate.month;
      allVehicleInFile &gt;&gt; delimiter; //delimiter = ':'
      allVehicleInFile &gt;&gt; allVehiclePointer[i].manufDate.day;
      allVehicleInFile &gt;&gt; delimiter;
      allVehicleInFile &gt;&gt; allVehiclePointer[i].manufDate.year;
  
      allVehicleInFile &gt;&gt; allVehiclePointer[i].shipDate.month;
      allVehicleInFile &gt;&gt; delimiter;
      allVehicleInFile &gt;&gt; allVehiclePointer[i].shipDate.day;
      allVehicleInFile &gt;&gt; delimiter;
      allVehicleInFile &gt;&gt; allVehiclePointer[i].shipDate.year;
  }
  allVehicleInFile.close();
  
  int dummyID = 0;
  allVehicleInFile.open("options.txt");
  //read vehicle options
  for (int j = 0; j &lt; totalVehicle; j++){
      allVehicleInFile &gt;&gt; dummyID;
     // if (dummyID == 20)
       //   dummyID = 0;
      allVehicleInFile &gt;&gt;      allVehiclePointer[dummyID].vehicleOptions.seatMaterial;
      allVehicleInFile &gt;&gt; allVehiclePointer[dummyID].vehicleOptions.wheelSize;
      allVehicleInFile &gt;&gt; allVehiclePointer[dummyID].vehicleOptions.stereo;
      allVehicleInFile &gt;&gt; allVehiclePointer[dummyID].vehicleOptions.winterPackage;
  }
  
  allVehicleInFile.close();
  allVehicleInFile.open("owner.txt");
  //read owner information
  for (int k = 0; k &lt; totalVehicle; k++){
      allVehicleInFile &gt;&gt; dummyID;
      //if (dummyID == 20)
        //dummyID = 0;
      allVehicleInFile &gt;&gt; allVehiclePointer[dummyID].receiverFlag;
  
      if (allVehiclePointer[dummyID].receiverFlag == 'D') //this is a dealer vehicle
          allVehicleInFile &gt;&gt; allVehiclePointer[dummyID].deal_zip;
      else{ // this is an individual's vehicle
          allVehicleInFile &gt;&gt; allVehiclePointer[dummyID].ind_first;
          allVehicleInFile &gt;&gt; allVehiclePointer[dummyID].ind_last;
          getline(allVehicleInFile, allVehiclePointer[dummyID].ind_address);
      }
  }
  allVehicleInFile.close();
  
  return allVehiclePointer;
  }
  
  
  /*
   * Responsible for printing menu and handling user selection
   *
   *
   * @param Vehicle: pointer pointing to the array of structs containing Hospital Personnel data
   * @param totalVehicle: size of Vehicle
   */
  
  void menu(Vehicle *vehicle, int totalVehicle)
  {
  int input;
  while( true )
  {
      cin &gt;&gt; input;
      switch( input )
      {
          case 0:
              // 0 - print all vehicles
              printVehicle(vehicle, totalVehicle, ' ');
              break;
          case 1:
              // 1 - print only vehicles manufactured for dealers
              printVehicle(vehicle, totalVehicle, 'D');
              break;
          case 2:
              // 2 - print only vehicles manufactured for individuals
              printVehicle(vehicle, totalVehicle, 'I');
              break;
          case 3:
              // 3 - print only vehicles with 4 cylinder engines
              printVehicle(vehicle, totalVehicle, '4');
              break;
          case 4:
              // 4 - print only vehicles with premium stereos
              printVehicle(vehicle, totalVehicle, 'P');
              break;
          case 5:
              // 5 - print only vehicles with leather seats
              printVehicle(vehicle, totalVehicle, 'L');
              break;
          case 6:
              // 6 - exit
              exit(0);
      }
  
  }
  }
  
  /*
   * Responsible for printing the Vehicle array of structs
   *
   *
   * @param vehicle: pointer pointing to the array of structs containing Vehicle data
   * @param totalVehicle: size of vehicle
   */
  void printVehicle(Vehicle *vehicle, int totalVehicle, char flags){
  
  if(vehicle == NULL || totalVehicle &lt; 1 )
  {
      return;
  }
  
  cout &lt;&lt; endl;
  printHorizontalLine(85, '*');
  printHorizontalLine(85, '*');
  for(int i = 0; i &lt; totalVehicle; i++)
  {
  
      if( flags != ' ' )
      {
          if( (flags == 'I' &amp;&amp; vehicle[i].receiverFlag != 'I') || (flags == 'D' &amp;&amp; vehicle[i].receiverFlag != 'D') || (flags == 'L' &amp;&amp; vehicle[i].vehicleOptions.seatMaterial != "Leather") || (flags == '4' &amp;&amp; vehicle[i].cylinder != 4) || (flags ==  'P' &amp;&amp; vehicle[i].vehicleOptions.stereo != "Premium"))
          {
              // skip roles which do not match roleFlag
              continue;
          }
      }
      // filter - end
  
      cout.clear();
      cout.fill(' ');
  
      cout
      &lt;&lt; left
      &lt;&lt; setw(3)
      &lt;&lt; i
      &lt;&lt; left &lt;&lt; setw(10)
      &lt;&lt; vehicle[i].name
      &lt;&lt; left &lt;&lt; setw(3)
      &lt;&lt; vehicle[i].cylinder
  
      &lt;&lt; left &lt;&lt; setw(10)
      &lt;&lt; vehicle[i].trans
      &lt;&lt; left
      &lt;&lt; vehicle[i].manufDate.month &lt;&lt; ':' &lt;&lt; vehicle[i].manufDate.day &lt;&lt; ':' &lt;&lt; vehicle[i].manufDate.year
      &lt;&lt; left &lt;&lt; "\t"
      &lt;&lt; vehicle[i].shipDate.month &lt;&lt; ':' &lt;&lt; vehicle[i].shipDate.day &lt;&lt; ':' &lt;&lt; vehicle[i].shipDate.year
      &lt;&lt; "\t" ;
  
      //print options
      cout &lt;&lt; left &lt;&lt; setw(10)
      &lt;&lt; vehicle[i].vehicleOptions.seatMaterial
      &lt;&lt; left &lt;&lt; setw(5)
      &lt;&lt; vehicle[i].vehicleOptions.wheelSize
      &lt;&lt; left &lt;&lt; setw(10)
      &lt;&lt; vehicle[i].vehicleOptions.stereo
      &lt;&lt; left &lt;&lt; setw(5) &lt;&lt; vehicle[i].vehicleOptions.winterPackage;
  
      cout &lt;&lt; left &lt;&lt; setw(3) &lt;&lt; vehicle[i].receiverFlag;
  
      if (vehicle[i].receiverFlag == 'D')
          cout &lt;&lt; left &lt;&lt; setw(7) &lt;&lt; vehicle[i].deal_zip;
      else
          cout &lt;&lt; left &lt;&lt; setw(3)
          &lt;&lt; vehicle[i].ind_first &lt;&lt; " " &lt;&lt; vehicle[i].ind_last
          &lt;&lt; "   "
          &lt;&lt; vehicle[i].ind_address;
  
      cout &lt;&lt; endl;
  }
  printHorizontalLine(85, '*');
  printHorizontalLine(85, '*');
  cout &lt;&lt; endl;
  cout &lt;&lt; "0 - Print all vehicles" &lt;&lt;endl;
  cout &lt;&lt; "1 - Print only vehicles manufactured for dealers" &lt;&lt; endl;
  cout &lt;&lt; "2 - Print only vehicles manufactured for individuals" &lt;&lt; endl;
  cout &lt;&lt; "3 - Print only vehicles with 4 cylinder engines" &lt;&lt; endl;
  cout &lt;&lt; "4 - Print only vehicles with premium stereos" &lt;&lt; endl;
  cout &lt;&lt; "5 - Print only vehicles with leather seats" &lt;&lt; endl;
  cout &lt;&lt; "6 - Exit: ";
  }
  
  
  /*
   * Responsible for printing a horizontal line which consists of border_char     characters
   * 
   *
   * @param width: count of border_char
   * @param border_char: width made out of characters
   */
  void printHorizontalLine( int width, char border_char )
  {
  cout.fill( border_char );
  cout &lt;&lt; setw( width ) &lt;&lt; border_char &lt;&lt; "\n";
  cout.fill(' ');
  }
  </code></pre>
  
  <p>In attempting to find the root of the issue, I isolated code and experimented with it. I found that when I uncommented these two bits of code, it broke.</p>
  
  <pre><code>(flags == 'L' &amp;&amp; vehicle[i].vehicleOptions.seatMaterial != "Leather")
  (flags ==  'P' &amp;&amp; vehicle[i].vehicleOptions.stereo != "Premium")
  </code></pre>
  
  <p>Here is the full text of the error: "The procedure entry point _ZNKSt7_cxx1112basic_stringlcSt11char_traitslcESalcEE7compareEPKc could not be located in the dynamic link library C:\Users\Zach\Documents\College - Spring 2017\CS 250\Assignment 1\Solution\Vehicles\bin\Debug\Vehicles.exe"</p>