make file in qnx

i donot have graphical version of QNX. so i donot have a nice IDE to work on. i need to make my own makefiles for all the projects i do.
i have made a few make files that work, but i have many problems.
the biggest problem is when i makefiles <iostream.h> doesnt work.
i get “undefined reference” error.

lets take a simple scenario: suppose, say i have “main.cpp” which included “header.h”. “header.h” has its corresponding “header.cpp”. both main.cpp and header.cpp includes other headers like <math.h>, <iostream.h> etc

makefile for such a scenario can be:

executable: main.o header.o
QCC -o executable main.o header.o

main.o: main.cpp header.h

header.o: header.cpp header.h

if i use this, iostream and math.h functions like cout, ,pow are given undefined reference errors. how to fix this?

now, what shud be the name of this make file? and how shud this be run in command line.

can the make file be named xxxx.make?
and to run can we give command
#make -f xxxx.make

i am used to working in VC++ where building is taken care of. Someone please help me in figuring this out. i am completely stuck at this. thanks in advance.

Try “QCC -lang-c++ hello.cpp -o hello”
It understood what cout was in the following code.


// start


main (int argc, char **argv)
cout << “Goodbye!\n”;
return 0;

// end

You might also investigate how the recursive makefile system that QNX uses works. There is a technical article on it here:
Look for “Make me a millionaire, part I” in the “Building, Porting and Packaging” section.

However, be aware that the recursive makefiles are very C-centric at this time. It is a little more complex to get a C++ app up and running. Once you have read and absorbed the information in the article, ask back here with any problems that you have.

You don’t actually have to give -lang-c++ with QCC, it is implied.