header, library what is it for?

Started by
1 comment, last by zip7000 21 years, 2 months ago
hi, I tried to compile a program that I got from a book but the following error comes up: g:\programmation\stydx7in24\source\hour 12\example\d3dutil.cpp(325) : fatal error C1010: unexpected end of file while looking for precompiled header directive Generating Code... Error executing cl.exe. the file d3dutil.cpp is at the right place. more generally what is the role of a header? (.h) what is the role of a library? (.lib) is there a difference between a .cpp and .lib file? what is the difference between : #include <file.h> and #include "file.h" thank you for any help you can give zip7000
Advertisement
My understanding, the role of the header file is to declare the code you are gonna use. The role of the cpp file is to define the code you declared in the header file. A library file is a compiled version of a Cpp file, and is unreadable to the user so you could provide the header and the library file for people to use and they wouldn''t be able to modify your source.

would be if you were using the standard headers
"file.h" is if you are getting a header from your directory..

The error you get is probably because your project is trying to use precompiled headers and the code doesn''t use them.. Go to your project, right click, selecting properties. Then select the C/C++ tab, in the drop down, select precompiled headers and then say No to precompiled headers.

Oh, and if I got any of my understandings mixed up here, I am sure people will correct me and I can learn from this..

=*=
If things seem bad, think that they can get a whole load worse, and they don''t seem so bad anymore

=*=
hey zip7000. that sounds like a MSVC++ project problem. try adding a #include "stdafx.h" line at the top of each of your cpp files. assuming you have a stdafx.h file in your project files, that is. if not, then try what hammerstein_02 suggests.

This topic is closed to new replies.

Advertisement