组织代码块中的文件 [英] Organization of files in Code Blocks

查看:74
本文介绍了组织代码块中的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在从事Code :: Blocks的中型/大型项目,我想知道如何组织文件。

I am currently working on a medium/large project on Code::Blocks and I am wondering how to organize my files.

首先,似乎创建了 虚拟文件夹中的虚拟文件夹是很自然的,但随后在磁盘上,所有文件都位于项目的根文件夹中,这对我来说似乎很混乱:如果我想在代码::块之外做某事,那么文件就很难了找到。无论如何,我应该使用这种方法吗?

First, it seems that creating "virtual folders" in Code::Blocks is quite natural but then on disk, all files are in the root folder of the project and it seems messy for me : if I want to do something outside of Code::Blocks, files are then hard to find. Should I use this method anyway ?

然后,如果每次需要时都创建真实文件夹,则需要将它们添加到路径中,以使它们成为内置的。另外,Code :: Blocks似乎不喜欢这样。有没有一种简单的方法可以对Code :: Blocks说:就像在我的项目目录中的子文件夹中的文件一样直接在根项目目录中构建文件,来构建项目?

Then if I create "real" folders every time I need them, I need to add them to the path in order for them to be built. Plus, Code::Blocks seems not to like that. Is there an easy way to say to Code::Blocks "build the project as if the files in the sub-folders in my project directory where directely inside the root project directory" ?

我没有在Internet上找到通常用Code :: Blocks组织项目的方式,欢迎任何链接

I did not find on the Internet how project are usually organized with Code::Blocks, any links are welcomed

推荐答案

大型项目组织


如果您要创建一个新项目,编写一个新的软件应用程序或要重构现有代码,则适当地构建您的项目是一个很好的选择。虽然可能有数百种构建方法,并且要考虑的事情很多,但在这里,我想给您一种可能的方法,这种方法一遍又一遍地为我服务。此示例/建议是我针对该主题进行的多年研究的摘要,因此不仅仅是一个主意

large projects organisation

If you are creating a new project, coding a new software application or want to refactor existing code, it's a good to properly structure your project. While there is probably hundreds of ways to structure and while there are many thing to consider, here I would like to give you one possible approach which has really worked for me over and over. This example/proposal is the summary of the years of research I have done regarding this topic, so it's not just 'an idea'

您肯定需要解决三个主要问题组织项目时:

There are three 'main' issues you definitely need to address when organising a project:

对于大型项目(不是所有项目),中级至大型项目应受版本控制(以GIT为例)。

Medium to large projects, not to say all projects, should be version controlled (GIT as an example).

中等规模的大型项目,而不是所有项目,应由项目生成器(例如,Cmake)维护。

medium to large projects, not to say all projects, should be maintained by a project generator (Cmake as an example).

它对于中型到大型项目,将所有文件保存在同一物理目录中是不可能的。甚至强烈建议不要这样做(根据包括Linux内核在内的一些准则)。您应该以物理逻辑方式组织这些文件

It would be impossible, for a medium to large project, to keep all files in the same physical directory. It is even strongly discouraged (by several guidelines including linux kernel). You should organize these files in a physical logical manner.

示例物理项目文件结构为:

An example physical projects file structure would be:

~example/environment$project tree .
.
|- code
     |- core
     |- extern
|- docs
|- tests
     |- core_tests
     |- extern-tests
|- ...

不幸的是,这在代码:: blocks中意味着您将必须将所有项目物理文件夹都包括到搜索路径中。

This, unfortunately in code::blocks, means you will have to include all your project physical folders to the search paths.

您可以以任何想要的方式在code :: blocks中组织文件,实际上,但是如果您物理结构是合乎逻辑的,您的项目应该直观易懂!

You can organize your files inside code::blocks in any way you want, virtually too, but if your physical structure is logical, your project should be intuitive to browse!

code :: blocks 不允许包含虚拟路径

code::blocks does not allow to include virtual paths.

希望这会有所帮助

KR

Hewi

这篇关于组织代码块中的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆