开发者

File and Folder structure of a App/Project based in C [closed]

开发者 https://www.devze.com 2022-12-22 13:47 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 3 years ago.

开发者_运维技巧 Improve this question

What would be the general structure of a App/Project based in C Programming language. libs, includes, header files. etc etc.

What would be the class structure. (in OOps) need to be scalable and other features. Something like main.cpp main.h

does any one have any good links or images or pdf?


Most of the projects follow a single hierarchy as follows:

project
\_ conf\   --> configuration files (Unix/Linux projects might prefer an 'etc' folder)
\_ src\    --> main source (for C++ projects, headers and sources go along, but if 
              your project is a library then separating include files for others 
              is a better practice)
\_ src\module1\ --> for each sub module (for multiple files having related contents,
                   it is better to separate them to their own subfolders)
\_ doc\    --> documentation 
\_ include\ --> (for library projects, the distributable include files)
\_ os\     --> OS (platform dependent) files (uch as makefiles, package building
              scripts..)
\_ res\    --> resources required for compilation but not source files (icons, etc.)
\_ MAKEFILE --> makefile script for building the project
\_ README   --> introductory document (might refer to doc\README)
\_ INSTALL  --> Installation document (might refer to doc\INSTALL)


For the directory layout/class structure I suggest reading this

http://www.javapractices.com/topic/TopicAction.do?Id=205

The link talks about Java but it applies to any Language (even non- OOP)

You might also find this interesting

http://www.gnu.org/prep/standards/html_node/index.html


What you could do is find an open-source project in the same domain and study their project structure and adapt it as needed.


I guess there are no common guidelines (at least, i've heard of none). Every company seem to have its own practices and recommendations. You may only rely on yourself and do whatever suits your current needs, i think.

Here's a link to the Google C++ Style Guide, if you haven't seen it already: https://google.github.io/styleguide/cppguide.html (they've got lots of ideas there, but i don't accept some of them, so it is a matter of choice)

Here's some other random guideline: http://geosoft.no/development/cppstyle.html

I guess you may take a look at those, but there is no general rule of thumb. Everything depends on your exact task.


Create individual libraries according to the functionality,make single include for all header files If it is C use .h or If it is C++ use .hpp format .then have single main file followed make to build all the libraries

OOPS will follows Main.cpp &Main.hpp format

0

精彩评论

暂无评论...
验证码 换一张
取 消