Results 1 to 3 of 3

Thread: Eclipse "Launch Failed: No Binaries"

  1. #1
    Join Date
    May 2007
    Location
    USA
    Posts
    373
    Thanks
    2
    Thanked 4 Times in 4 Posts

    Default Eclipse "Launch Failed: No Binaries"

    I'm using Eclipse for making C++ applications. Sometimes it runs smoothly, and sometimes, when I try compiling the program, I get a "No Binaries" issue. I've tried all the various ways of creating a C++ project it has to offer by default. Now, I'm running into this problem again, and I need to compile a program for my class tonight.

    If anyone can help me, that would be great.


    Here's my source if anyone wants to try compiling it if it works as is, which is doubtful.
    Code:
    //Program #14 Writing Structs to Files, Thomas Eding CS265-8051
    
    #include <cstdlib>
    #include <fstream>
    #include <iostream>
    
    using namespace std;
    
    struct Record {
    	char name[15];
    	double amt;
    }
    
    void printRecord(const Record &r) {
    	cout << "Name: " << r.name << "\nAmount: " << r.amt << "\n";
    }
    
    int main() {
    	Record master[10] = {{"Helen", 10}, {"Julie", 20}, {"Lena", 30}, {"Alan", 40}, {"Annie", 50}, {"May", 60}, {"Lee", 70}, {"Sam", 80}, {"June", 90}, {"Bill", 100}};
    	Record trans[7] = {{"Lena", 10}, {"Julie", 5.75}, {"Lee", 15.02}, {"Ed", 40}, {"Julie", 10}, {"Art", 5}, {"Bill", 7.32}};
    	ofstream fout;
    	fout.open("master.dat", ios::binary);
    	for(int i=0; i<10; ++i) fout.write((char*) &master[i], sizeof(Record));
    	fout.close();
    	fout.open("trans.dat", ios::binary);
    	for(int i=0; i<7; ++i) fout.write((char*) &trans[i], sizeof(Record));
    	fout.close();
    	Record temp;
    	ifstream fin;
    	fin.open("master.dat", ios::binary);
    	cout << "master.dat records:\n\n";
    	for(int i=0; i<10; ++i) {
    		fin.read((char*) &temp, sizeof(Record));
    		printRecord(temp);
    	}
    	fin.close();
    	fin.open("trans.dat", ios::binary);
    	cout << "trans.dat records:\n\n";
    	for(int i=0; i<7; ++i) {
    		fin.read((char*) &temp, sizeof(Record));
    		printRecord(temp);
    	}
    	fin.close();
    	return 0;
    }
    Trinithis

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    You're missing a colon after the ending brace of the struct definition, but other than that it's OK. I must say, though, it looks like a badly-translated C program. This is a task to which a class would be perfectly suited.

    A quick Google turned up a whole load of posts on various issues. I don't know which one matches your problem best, but you're sure to find an answer in there somewhere.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    May 2007
    Location
    USA
    Posts
    373
    Thanks
    2
    Thanked 4 Times in 4 Posts

    Default

    I would use classes, but my teacher wanted structs to be used, and I didn't feel like putting much effort into it

    **EDIT**
    Aha! I just had to select the right compiler, mingw, not cygwin

    Last edited by Trinithis; 10-11-2007 at 11:18 PM.
    Trinithis

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •