delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/12/29/00:43:51

From: "Klytu" <jazzyjeff34 AT hotmail DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Just a DJGPP Newbie
Date: Fri, 29 Dec 2000 00:25:13 -0500
Lines: 111
Message-ID: <92h77r$47b$1@bob.news.rcn.net>
References: <978030575 DOT 223213 AT news> <opan4t0nanl038smtu35i3c6surs851lst AT 4ax DOT com> <978046039 DOT 68387 AT news>
X-Trace: UmFuZG9tSVaiS5aallV5J531gL3VAjFyYR6IPg3uM2UaHbfIEnNrP7JcCML/LDTkhttEd6eViFY=
X-Complaints-To: abuse AT rcn DOT com
NNTP-Posting-Date: 29 Dec 2000 05:25:15 GMT
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
X-Priority: 3
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MSMail-Priority: Normal
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I work quite a bit with RHIDE and I am a newbie, also. Do not include ".h"
header files in your project; just include the implementation files. For
example, organize your code like this:

File snake.h:

// begin "snake.h"
#ifndef SNAKE_H
#define SNAKE_H

class Snake{
    public:
       Snake();
       void retMSG();
};

#endif
//  end "snake.h"

File snake.cpp:

// begin "snake.cpp"
#include "snake.h"
Snake::Snake()
{
}

void Snake::retMSG()
{
   cout<<"Ey!! I'm just a lousy dummy Snake"<<endl;
}
// end "snake.cpp"

File main.cpp:

//  begin "main.cpp"
#include <iostream.h>
#include "snake.h" // I know C++ is case sensitive

  int main()
 {
    Snake *snake;
     snake=new Snake();
    snake->retMSG();
    return 0;
}
// end "main.cpp"

Now you would include just the files "snake.cpp" and "main.cpp" in your
project and then choose "compile" and "run".

"Jose MF" <josemataf AT hotmail DOT com> wrote in message
news:978046039 DOT 68387 AT news...
>
> hmm, I just have solve my problem, but I don't like the way I did. Ok I'll
> start from the beggining.
>     I start rhide with the fation - c:\code\djgpp\bin\rhide ASnake - in
> order to start a project.
>     The program opens and I started the work.
>     In the button bar e select add twice and include the files ASnake.cpp
> and snake.h:
> They are the fowling:
> file://ASnake.cpp --
> #include <iostream.h>
> #include "snake.h" file://I know C++ is case sensitive
>
> void main()
> {
>    Snake *snake;
>    snake=new Snake();
>    snake->retMSG();
> }
>  file://snake.h --
>
> class Snake {
>    public :
>       Snake();
>       void retMSG();
> };
> Snake::Snake()
> {
> }
>
> void Snake::retMSG()
> {
>    cout<<"Ey!! I'm just a lousy dummy Snake"<<endl;
> }
>
> OK thats my program! Then in rhide I have a project with those 2 files
> included in it, I trie to run with the ASnake.cpp selected in screen and
it
> gives-me that "Don't Know how to build snake.o from snake.h" error.
> I don't think that is because a lack configuration, I pick some samples
> programs and their Run.
>     When I had an idea, I took snake.h off the project files list. I click
> run and the program really runned.
>     That means allways I start a project and want to create a include
file,
> I'll have to include the *.h file into project, edit the file and then
> exclude the file from project to run the program, or I'll have to
configure
> rhide to identify *.h has a include file to the compiler know how to
handle
> it?
> I tought it was automatic in Borland C it is. By the way, tanks to all
> replys, I really need your support.
>
>
>


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019