Thread: Problems w/ Dev C++

  1. #1
    Registered User
    Join Date
    Nov 2004
    Posts
    25

    Thumbs down Problems w/ Dev C++

    I wasn't really sure where to put this. It's my first post on this board, and it might not be the last.

    But anyways, I've been having trouble with that free compiler Dev C++ and I was wondering if anyone could help me.

    I wrote a console based program that stored contacts (as in, people's address and phone number etc..) using classes and vectors. I didn't finish writing it, (minus a few list functions, and all the saving/loading) but I tied off all the loose ends and got it to compile. (Almost. At first I had to send it to a friend using gcc to compile and then send the program back to me just to proove to me it wasn't the code)

    When it finally ran, nothing happened except I noticed it sitting around in the processes (I'm using XP sadly) taking up space, so I killed it. I figured since I had a prompt that it would at least stop there, and if somehow my program hadn't even made it that far, I decided to put a system("PAUSE"); in at the very beginning to see if it got that far, and it did. So I took that one out, and put one in a little after some output and other commands should've finished, but it only displayed the system("PAUSE");. This is boggling my mind, and no one else has been able to help me with this problem. If it persists, I'll uninstall DevC++ but I'd prefer not to.

    Any help would be appreciated.

  2. #2
    Registered User Dante Shamest's Avatar
    Join Date
    Apr 2003
    Posts
    970
    My guess is that your code isn't doing what you think it is. Post it.

  3. #3
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    your answer: it's not Dev-C++'s fault.

    give us some code and we'll show you where you went wrong. maybe you're right and you need to reinstall Dev-C++, because that has happened before, but it's usually not the case. especially when you're still using system("PAUSE"); to test your program...
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660

  5. #5
    Registered User
    Join Date
    Nov 2004
    Posts
    25

    Here's the code.

    I uninstalled DevCpp and reinstalled. Same problem. Maybe it is the code. Now hoever, there's one error that won't even let it compile that I can't figure out. (Jeeze this is a wreck huh?) It says:

    2
    C:\Documents and Settings\Start\My Documents\Eli\C++\Projects\CM\2
    unable to run program file.

    It used to compile, and only do system("PAUSE");, now it just doesn't compile. I don't know how much you guys wanna see so.... O.o here's everything I have done, and thanks for your time:

    Code:
    //Just so you all know, this isn't meant to work correctly yet. 
    //but this SHOULD compile. Anyways, I'm a beginner, so any help would be 
    //much appreciated.
    
    #include <iostream>
    #include <vector>
    #include <fstream>
    #include <strings>
    
    using namespace std;
    
    class contact{
        public:
            contact(string* name){
    	    firstName=*name;
    	}
        protected:
            string firstName;
    };
    
    class list{
        public:
            list(string* name){
    	    listName=name
    	}
    	void nCont();{
    	    return;
            }
    	void eCont();{
    	    return;
    	}
    	void vCont();{
    	    return;
    	}
    	void dCont();{
    	    return;
    	}
        protected:
    	string listName;
    	vector<contact> contactList;
    };
    
    void cList(); // Create list
    void lList(); // Load list
    void vList(); // View list
    void sList(); // Save list
    void dList(); // Delete list
    
    char debug; // For debugging
    
    int main(){
        
        cout << "DEBUG: Start of program..." << endl;
        cin >> debug; // This doesn't work?
        
        cout << "Contact Manager..." << endl;
        cout << "Input 'h' for help." << endl << endl;
        
        system("PAUSE"); // But this does!
        
        list none;
        none.setBlank();
    
        cLine(&none); // Enter commands, pass a blank list
        return 0;
    }
    
    void cLine(list *noList){
        
        char cBuff; // Input buffer
        
        list *loaded=noList;
        
        do{
            cout << ">";cin >> cBuff; /*Read command*/ cout << "\n";
            
            switch (cBuff){ // Evaluate command
                case 'h':
                case 'H': // Show help
                    showHelp();
                    break;
                case 'q': 
                case 'Q': // Quit after confirm, if no, prompt
                    cout << "\n"
                         << "You have chosen to quit. Any unsaved information will"
                         << "be lost.\nAre you sure? [y/n]: ";
                    cin >> cBuff;
                    if (cBuff=='y'||cBuff=='Y'){ // Only 'y'||'Y' terminates
                        return;
                    }
                    else{ // Anything else aborts termination
                        cout << "\n"
                             << "Quitting aborted...\n";
                    }            
                    break;
                case 'c':
                case 'C':
                    cList();
                    break;
                case 'l':
                case 'L':
                    lList();
                    break;
                case 'i':
                case 'I':
                    vList();
                    break;
                case 's':
                case 'S':
                    sList();
                    break;
                case 'd':
                case 'D':
                    dList();
                    break;
                case 'n': /* There's a better way to do all of these using a member function that */
                case 'N': /* checks to see if the loaded list is blank, but I'll use this for now. */
                    if (loaded->blank==true){
    		    cout << "Please [l]oad a list first.\n";
    		}
    		else{
    		    loaded->nCont();
    		}
                    break;
                case 'e':
                case 'E':
                    if (loaded->blank==true){
                        cout << "Please [l]oad a list first.\n";
                    }
                    else{
                        loaded->eCont();
                    }    
                    break;
                case 'v':
                case 'V':
                    if (loaded->blank==true){
                        cout << "Please [l]oad a list first.\n";
                    }
                    else{
                        loaded->vCont();
                    }    
                    break;
                case 't':
                case 'T':
                    if (loaded->blank==true){
                        cout << "Please [l]oad a list first.\n";
                    }
                    else{
                        loaded->dCont();
                    }    
                    break;
                default:
                    cout << "Illeagal command. Input 'h' to display help.\n";
                    break;
            }    
        }
        while(true);
        return;    
    }
    
    void showHelp(){ // Display help
        cout << "\n"
             << "Issue a command by inputting the coresposnding\n"
             << "letter in brackets.\n"
             << "\n"
             << "[H]elp\n"
             << "[Q]uit\n"
             << "[C]reate New Contact List\n"
             << "[L]oad Contact List\n"
             << "V[i]ew Contact List\n"
             << "[S]ave Contact List\n"
             << "[D]elete Contact List\n"
             << "Create [N]ew Contact\n"
             << "[E]dit Contact\n"
             << "[V]iew Contact\n"
             << "Dele[t]e Contact\n"
             << "\n";
        return;
    }
    
    void cList(){ // Doesn't actually do anything yet.
        string name;
        cout << "Input name for list: ";
        cin >> name;
        
        cout << "List " << name << "created. Remember to save.\n";
        return;
    }
    
    void lList(){
        return;
    }    
    
    void vList(){
        return;
    }
    
    void sList(){
        return;
    }
    
    void dList(){
        return;
    }
    Hope this is what you guys need.

  6. #6
    Registered User
    Join Date
    Nov 2004
    Posts
    25

    Question Update

    I figured if it was the code, I'd just start from scratch and see where it went wrong along the way.

    The following code also gave me the same exact compile error as stated above:

    Code:
    #include <iostream>
    
    using namespace std;
    
    int main(){
        char x;
        cout << "Hello world!";
        cin >> x;
        
        return 0;
    }
    If I didn't know any better I'd assume it was my code, but after testing a little program like that and getting the same error...

    My guess is something got switched around in the preferences or options, and I'm not sure what. (I haven't even touched them this install, so the default settings don't work for me if that's the case.)

    If someone can either fix this, or suggest a good IDE/Compiler for beginners, I'd be very greatful.

    I used a linux based editor during a programming competition once that I liked, but I forget the name of it.

    Thanks a lot.

  7. #7
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    There is an unofficial dev-cpp faq here which I recommend that you read. Pay particular attention to the install/uninstall sections.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  8. #8
    Registered User
    Join Date
    Nov 2004
    Posts
    25

    D'uh

    Well, I read the FAQ, and it fixed the problem. Windows XP are teh sux0rz.

    I feel like a moron for not looking at the FAQ earlier, but it's OK. At least I can compile my own friggin' programs now.

    I feel embarassed to have posted that code, since now that the compiler works, I realize that whole thing is a giant mess. ^^

    Oh well. Live and learn. I'll probably just start it over from scratch.

    Thanks a lot you guys, especially Ken. ;-)

    Wish me luck.

  9. #9
    Hamster without a wheel iain's Avatar
    Join Date
    Aug 2001
    Posts
    1,385
    >>Oh well. Live and learn

    and thats exactly what this board exists for

    >>linux based editor during a programming competition
    my personal recommendation is Kwrite, and emacs comes in a close second (you need to change the preferences so it colour codes code)
    Monday - what a way to spend a seventh of your life

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. No clue how to make a code to solve problems!
    By ctnzn in forum C Programming
    Replies: 8
    Last Post: 10-16-2008, 02:59 AM
  2. Programming With Dev C++
    By v01d in forum C++ Programming
    Replies: 3
    Last Post: 09-14-2007, 01:51 AM
  3. C Pointers Problems
    By mhelal in forum C Programming
    Replies: 8
    Last Post: 01-10-2007, 06:35 AM
  4. String Manipulation problems -_-
    By Astra in forum C Programming
    Replies: 5
    Last Post: 12-13-2006, 05:48 PM
  5. Dev and errors
    By Moffesto in forum C++ Programming
    Replies: 0
    Last Post: 06-22-2002, 12:17 AM