Mail Archives: djgpp/2000/12/29/00:43:51
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 -