Beginner C/C++

Moderators: None (Apply to moderate this forum)
Number of threads: 5430
Number of posts: 16951

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Include header Posted by binnykt on 6 Oct 2008 at 1:19 AM

I got a source code from the internet about a simple paint program.
The program works fine,but when i try to compile the source code,it cant find the header file(user defined).I did get the header file but i dont how to include it in the directory.I use Bloodshed Dev C++ version 2.Can anyone help me solve this problem?

Report
Re: Include header Posted by Lundin on 6 Oct 2008 at 2:26 AM
Put it with the rest of the code, then #include "header_name.h", and that's it. You usually don't need to include h-files in the project since they are never linked to binaries (unless they are written by a newbie). It can be convenient to include them in the project still, so you can open them quickly.
Report
Re: Include header Posted by binnykt on 6 Oct 2008 at 4:51 AM
: Put it with the rest of the code, then #include "header_name.h", and
: that's it. You usually don't need to include h-files in the project
: since they are never linked to binaries (unless they are written by
: a newbie). It can be convenient to include them in the project
: still, so you can open them quickly.
:

Well the #include<header.h> is already in the program, but when the compiler reaches that line it says headername.h file not found.
Thanks

Report
Re: Include header Posted by Lundin on 6 Oct 2008 at 5:27 AM
#include <header.h>

tells the compiler to look in the compiler libraries for the file.

#include "header.h"

tells the compiler to look in the same directory as the source file including it.
Report
Re: Include header Posted by binnykt on 6 Oct 2008 at 9:34 AM
: #include <header.h>
:
: tells the compiler to look in the compiler libraries for the file.
:
: #include "header.h"
:
: tells the compiler to look in the same directory as the source file
: including it.


I did that but the problem persists.I have a screenshot of it as an attachment
Thanks


Attachment: Header.zip (38079 Bytes | downloaded 64 times)
Report
Re: Include header Posted by Lundin on 6 Oct 2008 at 11:50 PM
It is complaining about graphics.h, not your custom header. Dev is a bit glitchy it seems, pointing at the wrong line.

graphics.h refers to the ancient BGI graphic library that works in Borland's DOS compilers only. dos.h only works on DOS compilers as well. You can't use those files in modern Windows programs.
Report
Re: Include header Posted by binnykt on 7 Oct 2008 at 8:52 AM
: It is complaining about graphics.h, not your custom header. Dev is a
: bit glitchy it seems, pointing at the wrong line.
:
: graphics.h refers to the ancient BGI graphic library that works in
: Borland's DOS compilers only. dos.h only works on DOS compilers as
: well. You can't use those files in modern Windows programs.


Well I understand that & luckily i have those old compilers,but how do you include the header file in the program in the old compiler?
Thanks





 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.