Definition File Problems

This is a discussion on Definition File Problems within the C++ Programming forums, part of the General Programming Boards category; The complaint is 'Unexpected end of file when looking for precompiled header directive'. This message is given in all 3 ...

  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 11: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, 05:27 PM
  2. opening empty file causes access violation
    By trevordunstan in forum C Programming
    Replies: 10
    Last Post: 10-22-2008, 12:19 AM
  3. Formatting a text file...
    By dagorsul in forum C Programming
    Replies: 12
    Last Post: 05-02-2008, 04:53 AM
  4. help with text input
    By Alphawaves in forum C Programming
    Replies: 8
    Last Post: 04-08-2007, 05:54 PM
  5. archive format
    By Nor in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 08-05-2003, 08:01 PM

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