Jump to content

Problem with header

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
25 replies to this topic

#1
BINNY88

BINNY88

    Learning Programmer

  • Members
  • PipPipPip
  • 38 posts
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 together with the source code & program, but i dont how to include it in the directory.I use Bloodshed Dev C++ version 2.Can anyone help me solve this problem?

Forging ahead

#2
v0id

v0id

    Retired

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,936 posts
If you don't want to work with the compiler yourself and want Dev-C++ to do the job, then create a project, add both files, and compile.

#3
BINNY88

BINNY88

    Learning Programmer

  • Members
  • PipPipPip
  • 38 posts

I dont understand what you are trying to say.How do i add the files??
Thanks

Forging ahead

#4
v0id

v0id

    Retired

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,936 posts
I haven't used Dev-C++ for a long, long time, so I don't remember exactly. But you could try looking in the "Files..." menu, and see if you can find something like "New..." > "Project," or alike. When you've created the project you can see some kind of tree hierachy of files out on the left side. There you can add the files you have, the source and the header.

Actually, I thought Dev-C++ would find the header automatically, also when you're just compiling one file, but now that it doesn't, you can always compile by hand. Start the commandprompt, cd to the folder where your files are, and write: g++ source.cpp -o executable, where source.cpp shall be the source file you have, and executable the name of the executable you want to be generated.

#5
BINNY88

BINNY88

    Learning Programmer

  • Members
  • PipPipPip
  • 38 posts

Thanks for the suggestions but I am still not getting the hang of it & besides I dont think dev c++ supports graphics.h since the error msg says cant find such file or directory.I do have a screen shot of the problem

Attached Files


Forging ahead

#6
dcs

dcs

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 775 posts
It looks like you're trying to compile ancient nonstandard code with a modern standard compiler. What you see is what you get.

You'd need more than just the header, you also need the library code -- but I believe that is Borland's BGI interface.

You might be better served by trying to use something more up-to-date, rather than trying to learn decade-old all-but-dead technology.

#7
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,709 posts
Use GDI, GDI+, or DirectX, since they're more up-to-date. I'm assuming that you're writing this for Windows because of the presence of dos.h in your includes. That, by the way, is also outdated.

#8
llstartl

llstartl

    Newbie

  • Members
  • Pip
  • 3 posts
rewrite, use opengl

#9
dargueta

dargueta

    Writes binary right handed and hex left handed

  • Moderators
  • 4,709 posts
Actually that's probably a better idea since it's retargetable. Unless you're developing specifically for Windows and have no intention of porting to other systems, ignore my previous suggestion. I can't help you with OpenGL because I have no experience, but I do have some with GDI+.

#10
BINNY88

BINNY88

    Learning Programmer

  • Members
  • PipPipPip
  • 38 posts
Yes i know its outdated but my university still uses the old turbo c++ ide(1990),you know the one with the blue screen which is now available for free(the colege doesnt need to pay for license) & here i am trying to compile in a modern compiler.By the way its for my miniproject though,the simpler it is,the less questions i have to answer & the simplest program is a console application & the examiners are more used to the old console applications
Thanks

Forging ahead

#11
dcs

dcs

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 775 posts

BINNY88 said:

Yes i know its outdated but my university still uses the old turbo c++ ide(1990),you know the one with the blue screen which is now available for free(the colege doesnt need to pay for license) & here i am trying to compile in a modern compiler.
As an aside, I've seen this similar tale quite frequently from students in India and Pakistan for at least 6 years now. I really wish the faculty there had realized long ago that they can get free, modern, up-to-standards compilers -- and have been this entire time.

It also bothers me that the students pay for an education and are taught things that have been officially dead for 10 years. And at the same time, freely available on the web are plenty of resources that one can use to be pretty much up to speed with the times.[/rant]

BINNY88 said:

By the way its for my miniproject though,the simpler it is,the less questions i have to answer & the simplest program is a console application & the examiners are more used to the old console applications
If possible, I might recommend doing console apps that do not depend on non-standard libraries. Things like clearing the screen and cursor placement are kewl for all of your early time programming -- after that it's kind of annoying.

But if you must use these libraries for API handling such as mouse events and what not, perhaps I can take another shot at answering this.

#12
BINNY88

BINNY88

    Learning Programmer

  • Members
  • PipPipPip
  • 38 posts

Thanks for your advice dcs.Most universities in India still use those old compilers,but the good thing is there are many private computer centers offering courses in the latest computer breakthroughs & the mainproject is usually done using ASP.net technologies(I dont know what they are yet)and other languages.I heard the words library,API,only when i joined this forum.We didnt care about such stuff until now.I have made a few attempts to study visual c++ & c# but progress is still slow,since i have to study other subjects in the syllabus.I did solve the problem when i compiled the code using the old compiler.
p.s I am really interested in your mentioning of mouse events.Do mention more if u have the time.Just mentioning resources will be more than enough.

Best regards

Forging ahead