c++ - including header file in a separate folder -


i created class (say, myclass.h/cpp). want use class many different places. therefore, put files in folder (say, c:\cpp_include) , want include them whatever folder codes are. have code uses class (say, main.cpp). in main.cpp, include myclass:

#include "myclass.h" 

i compile using .pro file , nmake. in .pro file, specify folder as:

includepath += c:\cpp_include 

when compile code using nmake, myclass.h included, myclass.cpp doesn't seem found compiler. when specify myclass.cpp 1 of source files in .pro file:

sources += main.cpp c:\cpp_include\myclass.cpp 

the exe file built correctly. but, myclass.cpp file found automatically when myclass.h included, i.e. without setting myclass.cpp source file. possible? looks that's happens classes qt , qwt (e.g .h/cpp files in /src/ folder in qt , qwt). missing somthing?

thanks lot!

daisuke

a simple technique have build scripts (makefiles) in cpp directories. write rule traverses directories, executing build scripts. 1 step in isolating functionality , allows 1 use libraries.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -