Simple program won't work on a friend's comp

This is a discussion on Simple program won't work on a friend's comp within the C++ Programming forums, part of the General Programming Boards category; I sent one of my friends a very simple program, but they said it didn't work, and they said they ...

  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    5

    Simple program won't work on a friend's comp

    I sent one of my friends a very simple program, but they said it didn't work, and they said they got an error that said their computer couldn't recognize the file extension or something.

    Here's the following code, made in Dev-C++. (btw, this is the exact same code as one of the sample programs in a tutorial)

    Code:
    #include <iostream>	
    
    using namespace std;
    		
    int main()                            // Most important part of the program!
    {
      int age;                            // Need a variable...
      
      cout<<"Please input your age: ";    // Asks for age
      cin>> age;                          // The input is put in age
      cin.ignore();                       // Throw away enter
      if ( age < 100 ) {                  // If the age is less than 100
         cout<<"You are pretty young!\n"; // Just to show you it works...
      }
      else if ( age == 100 ) {            // I use else just to show an example 
         cout<<"You are old\n";           // Just to show you it works...
      }
      else {
        cout<<"You are really old\n";     // Executed if no other statement is
      }
      cin.get();
    }

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    So, did you send the executable file, or the .cpp file? If your friend doesn't have a compiler, the source code won't be able to compile.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Jan 2008
    Posts
    5
    Quote Originally Posted by matsp View Post
    So, did you send the executable file, or the .cpp file? If your friend doesn't have a compiler, the source code won't be able to compile.

    --
    Mats
    .EXE

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Ah, and you probably didn't supply the necessary DLL files - they are part of the installation for the compiler, and won't necessarily be on other machines.

    First of all, you may find that it works better to build a "release" version of the application - that is an optimized app with no debug information. If that's not enough to make it work, you may need to ALSO link the C runtime library statically.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Registered User
    Join Date
    Jan 2005
    Posts
    7,319
    >> they said they got an error that said their computer couldn't recognize the file extension or something.

    For an exe file? Is their computer running Windows?

  6. #6
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Katy, Texas
    Posts
    2,309
    Quote Originally Posted by Ouendanation View Post
    I sent one of my friends a very simple program, but they said it didn't work, and they said they got an error that said their computer couldn't recognize the file extension or something.
    Well then, we should all keep guessing... or something.

  7. #7
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Katy, Texas
    Posts
    2,309
    This could be because receiver did not SAVE AS properly. Lot's of mail systems won't even allow .exe attachments.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 09-30-2007, 11:08 PM
  2. Help with a very simple program
    By htdefiant in forum C++ Programming
    Replies: 13
    Last Post: 08-14-2007, 01:27 PM
  3. Why does this program not work on my laptop?!
    By Eddie K in forum C Programming
    Replies: 1
    Last Post: 03-11-2006, 03:34 PM
  4. Problem with simple XOR program
    By spike_ in forum C++ Programming
    Replies: 8
    Last Post: 08-17-2005, 12:09 AM
  5. simple frontend program problem
    By gandalf_bar in forum Linux Programming
    Replies: 16
    Last Post: 04-22-2004, 06:33 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21