Hello,
To begin with, if you allow me, I'd like to let the readers know that I have done my search on search engines, this wonderful forum and also checked related examples through active open-source projects. Yet I couldn't find an answer nor a solution to my worry and hence the reason I am opening this thread.
About the situation:
I am a Python programmer. I have been so for quite some time and embraced what Python community calls as the "python way" or "pythonic" way of doing things.
Now I have been training in C++ and I am starting to port a Python application (Qt via PySide) to C++.
Bit of information:
In Python projects, there are "modules" which are widely embraced to structure one's application source code.
Easy object file or bundle of functions in a source code file can be, and is advised to be, placed in a related module where all related elements are bundled and accessed through Module's name.
Ex: All "sound" related classes and functions can be placed in a "module" folder called "sounds" and accessed through "import sounds" or "from sounds import class_name".
My problem:
The above explained way of structuring source code makes it very easy to find things and allows you to find your way through projects.
Instead of my Qt project's simple two-folder structure of "/Headers" and "/Sources", I would like to have sub folders for each related class group.
Example:
/MyApp
main.cpp
-SoundModule <-Module Folder
--Headers
---Processor.h
--Sources
---Processor.cpp
-CustomControls <-Module Folder
--Headers
..
--Sources
.. |
etc.
I'm currently working on OS X and this application is to be build there first but then built on Windows and especially Linux.
I have read about "import problems" "compile import errors" etc.
I wish to have a well structed source code as explained above and do not wish to have import errors which could discourage people from building it or cause problems to my self building it on other platforms.
My question/request:
- Could you please explain [to me], how can I go on structuring my application this way?
- How can I perform imports from inside a module's source file to another and/or from main.cpp file?
- What things do I need to pay attention to?
- If I am [to have] this source code to be ported to more than on OS Platform, what do I need to do?
I hope I managed to explain myself.
Thank you for your time and kind answers in advance.