Thread: Program doesn't work after changing computers.

  1. #1
    1479
    Join Date
    Aug 2003
    Posts
    253

    Program doesn't work after changing computers.

    I started this program on a different computer. I saved all the files I needed and zipped them and e-mailed them to a different computer. When I got home I unzipped the folder and opened the source code, clicked 'compile and run' and got 161 errors :( . I don't know what the problem is because it worked fine with 0 errors before I changed computers. Here is the source code:

    Compiler: Dev-C++ 4.9.9.2

    Code:
    #include <fstream>
    #include <iostream>
    
    using namespace std;
    
    char YourName[10];
    int input;
    char Race[15];
    
    char NewChar()
    {
         cout <<"Please enter a name. No more than 15 characters and NO SPACES!!!" <<endl;
         cin >>YourName; 
         cout <<endl;
         ofstream a_file ( "profile.txt");       
         a_file<<"Name = " <<YourName <<endl;
         cout <<"================Choose a race=================" <<endl;
         cout <<"|                                            |" <<endl;
         cout <<"|         [1.] Human                         |" <<endl;
         cout <<"|         [2.] Enchanter                     |" <<endl;
         cout <<"|         [3.] Brute                         |" <<endl;
         cout <<"|         [4.] ???????                       |" <<endl;
         cout <<"|         [5.] ???????                       |" <<endl;
         cout <<"|                                            |" <<endl;
         cout <<"=============================================|" <<endl;
         cin>>input;
         
         switch (input){
                case 1:
                     //Race = "Human"; 
                     a_file<<"Race = Human" <<endl;
                     cout <<"Text here"<<endl;
                     cout <<"Text here." <<endl;
                     cout <<"Text here."<<endl;
                     cout <<"Text here." <<endl;
                     cout <<"Racial bonus includes:";
                     cout <<" +100 hp's";
                     break;
                case 2:
                     //Race = "Enchanter";
                     a_file<<"Race = Enchanter" <<endl;
                     cout <<"Text here." <<endl;
                     cout <<"Text here." <<endl;
                     cout <<"Text here." <<endl;
                     cout <<"Racial Bonus includes:";
                     cout <<" +100 mp's";
                     break;
                case 3: 
                     //Race = "Brute";
                     a_file<<"Race = Brute" <<endl;
                     cout <<"Text here." <<endl;
                     cout <<"Text here." <<endl;
                     cout <<"Racial Bonus includes:";
                     cout <<" +10 Str, +100 hp's";
                     break;
                default:
                        cout <<"Not an acceptable choice, please try again!";
                        break;
                        }
                       a_file.close(); 
         
    }
    void LoadChar();
    void Story();
    void Options();
    void StartGame()
    {
         cout <<"=======Welcome to the Age of Spire============" <<endl;
         cout <<"|                                            |" <<endl;
         cout <<"|         [1.] Create new Character          |" <<endl;
         cout <<"|         [2.] Load Character                |" <<endl;
         cout <<"|         [3.] Veiw Story/History            |" <<endl;
         cout <<"|         [4.] Options                       |" <<endl;
         cout <<"|         [5.] Credits                       |" <<endl;
         cout <<"|                                            |" <<endl;
         cout <<"=============================================|" <<endl;
         cin>>input;
         
         
         switch (input) {
                case 1:
                     NewChar();
                     //cout <<"Create char screen" <<endl;
                     break;
                case 2:
                     //LoadChar();
                     cout <<"Load screen" <<endl;
                     break;
                case 3:
                     //Story();
                     cout <<"Show story" <<endl;
                     break;
                case 4:
                     cout <<"Sorry, not impletmented yet." <<endl;
                     break;
                case 5:
                     cout <<"Created by:*********" <<endl;
                     cout <<"    ************    " <<endl;
                     break;
                default:
                        cout <<"Not a valid imput please try again." <<endl;
                        break;
                        }
    }
      int main()
    {
        StartGame();
        ifstream b_file ( "profile.txt" );
        b_file >>YourName[10];
        b_file.close();
        cin.ignore();
        cin.get();
        
    }

    And here is the compile log.


    Compiler: Default compiler
    Executing g++.exe...
    g++.exe "C:\Dev-C++\AoS test.cpp" -o "C:\Dev-C++\AoS test.exe" -g3 -I"C:\Dev-Cpp\include\c++" -I"C:\Dev-Cpp\include\c++\mingw32" -I"C:\Dev-Cpp\include\c++\backward" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib" -g3
    In file included from C:/Dev-Cpp/include/c++/bits/basic_ios.h:41,
    from C:/Dev-Cpp/include/c++/ios:51,
    from C:/Dev-Cpp/include/c++/istream:44,
    from C:/Dev-Cpp/include/c++/fstream:45,
    from C:\Dev-C++\AoS test.cpp:1:
    C:/Dev-Cpp/include/c++/bits/locale_facets.h: In constructor `std::numpunct_byname<_CharT>::numpunct_byname(con st char*, size_t)':
    C:/Dev-Cpp/include/c++/bits/locale_facets.h:564: error: there are no arguments to `_S_create_c_locale' that depend on a template parameter, so a declaration of `_S_create_c_locale' must be available
    C:/Dev-Cpp/include/c++/bits/locale_facets.h:564: error: (if you use `-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
    C:/Dev-Cpp/include/c++/bits/locale_facets.h:565: error: there are no arguments to `_M_initialize_numpunct' that depend on a template parameter, so a declaration of `_M_initialize_numpunct' must be available
    C:/Dev-Cpp/include/c++/bits/locale_facets.h: In destructor `virtual std::numpunct_byname<_CharT>::~numpunct_byname()':
    C:/Dev-Cpp/include/c++/bits/locale_facets.h:571: error: there are no arguments to `_S_destroy_c_locale' that depend on a template parameter, so a declaration of `_S_destroy_c_locale' must be available



    Execution terminated

    I shortened the compile log down. It is a lot bigger but its mostly repeated stuff. My guess is that either my header files are messed up or that it has something to do with me changing computers.
    Knowledge is power and I want it all

    -0RealityFusion0-

  2. #2
    Registered User
    Join Date
    Aug 2005
    Posts
    91
    Maybe the problems are compiler-specific? Did you change compilers when you changed computers?

  3. #3
    1479
    Join Date
    Aug 2003
    Posts
    253
    I used the same version of Dev-C++.
    Knowledge is power and I want it all

    -0RealityFusion0-

  4. #4
    Registered User
    Join Date
    Aug 2005
    Posts
    91
    Compiles fine for me, and I use Dev-C++ 4.9.9.2.

  5. #5
    1479
    Join Date
    Aug 2003
    Posts
    253
    Yeah, thats wierd....I use the same version too. I can run the program but I just can't 'compile and run'.
    Knowledge is power and I want it all

    -0RealityFusion0-

  6. #6
    Registered User
    Join Date
    Aug 2005
    Posts
    91
    I can compile and run just fine. Maybe you should reinstall Dev-C++ or something?

  7. #7
    1479
    Join Date
    Aug 2003
    Posts
    253
    Yeah, that worked thanks.
    Knowledge is power and I want it all

    -0RealityFusion0-

  8. #8
    Registered User
    Join Date
    Aug 2005
    Posts
    91
    That's surprising. I just said it because sometimes files could become faulty or something... heh.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program Plan
    By Programmer_P in forum C++ Programming
    Replies: 0
    Last Post: 05-11-2009, 01:42 AM
  2. My program doesn't work on others comps
    By Livijn in forum C# Programming
    Replies: 8
    Last Post: 10-29-2008, 06:03 AM
  3. Program doesnt work properly.
    By +Azazel+ in forum C Programming
    Replies: 4
    Last Post: 10-12-2007, 06:57 AM
  4. program from book wont work
    By cemock in forum C Programming
    Replies: 2
    Last Post: 03-06-2003, 09:58 AM
  5. Can't get program to work
    By theirishrover12 in forum C Programming
    Replies: 1
    Last Post: 06-08-2002, 11:10 AM