Thread: Definition File Problems

  1. #1
    Anti-Terrorist
    Join Date
    Aug 2001
    Location
    mming, Game DevelopmentCSR >&<>&2Minimization of boolean functions, PROM,PLA design >&0>&WA, USA guitar, dogsCommercial Aviation >&>>&USAProgramming
    Posts
    742

    Definition File Problems

    The complaint is 'Unexpected end of file when looking for precompiled header directive'. This message is given in all 3 of my .cpp files. Here is one of them:

    Student_info.cpp
    Code:
    #include "Student_info.h"
    
    using namespace std;
    
    bool compare(const Student_info& x, const Student_info y)
    {
    	return x.name < y.name;
    }
    
    istream& read(istream& is, Student_info s)
    {
    	is >> s.name >> s.midterm >> s.final;
    
    	read_hw(is, s.homework);
    	return is;
    }
    
    istream& read_hw(istream& in, vector<double>& hw)
    {
    	if(in) {
    		//get rid of previous contents
    		hw.clear();
    
    		double x;
    		while(in >> x)
    			hw.push_back(x);
    		in.clear();
    	}
    	return in;
    }
    Do you know what the error means? Actually here is the header file as well.

    Student_info.h
    Code:
    #ifndef GUARD_Student_info
    #define GUARD_Student_info
    
    #include<iostream>
    #include<string>
    #include<vector>
    
    struct Student_info{
    	std::string name;
    	double midterm, final;
    	std::vector<double> homework;
    };
    
    bool compare(const Student_info&, const Student_info&);
    std::istream& read(std::istream&, Student_info&);
    std::istream& read_hw(std::istream&, std::vector<double>&);
    #endif
    Last edited by Witch_King; 09-01-2001 at 10:46 PM.
    I compile code with:
    Visual Studio.NET beta2

  2. #2
    Anti-Terrorist
    Join Date
    Aug 2001
    Location
    mming, Game DevelopmentCSR >&<>&2Minimization of boolean functions, PROM,PLA design >&0>&WA, USA guitar, dogsCommercial Aviation >&>>&USAProgramming
    Posts
    742
    Okay I got it all to work out. There were a couple of syntax errors in my program and also I had to use this line of code at the beginning of all my .cpp files:
    Code:
    #include "StdAfx.h"
    I only had that in my main source (.cpp) file to start with.
    I compile code with:
    Visual Studio.NET beta2

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Newbie homework help
    By fossage in forum C Programming
    Replies: 3
    Last Post: 04-30-2009, 04:27 PM
  2. opening empty file causes access violation
    By trevordunstan in forum C Programming
    Replies: 10
    Last Post: 10-21-2008, 11:19 PM
  3. Formatting a text file...
    By dagorsul in forum C Programming
    Replies: 12
    Last Post: 05-02-2008, 03:53 AM
  4. help with text input
    By Alphawaves in forum C Programming
    Replies: 8
    Last Post: 04-08-2007, 04:54 PM
  5. archive format
    By Nor in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 08-05-2003, 07:01 PM