PDA

View Full Version : including



mickey
26th July 2006, 20:05
hi, hi have 2 app that shared a .cpp; in cpp there is a <qfile.h>; but only one app use this <qfile.h> the other no! is there a way to include/exclude this .h such as "if I'm app1 use qfile"...thanks

jacek
26th July 2006, 21:27
How come if you use that .cpp file in one application it must include qfile.h and if you use it in another application --- it doesn't? What you should include depends on the code itself, not where you use it.

Anyway you can use #ifdef and #define for this.

mickey
26th July 2006, 22:08
app1 use a hello.cpp because it use some function(not all); app2 use other function of hello.cpp (but not all). app1 need the function that need (sorry) "myFile.h"; so app2 doesn't use that header but I have to add it in .pro. I don't want to add "myFile.h" line in .pro in the app2.(otherwise don't compile).ok? How can I?