我目前是一个学生,需要学习C。我正在使用Clion在Debian虚拟机上工作。
为了更好地管理我的作业,我创建了一个GitHub存储库来同步和存储所有C分配。因此,我在GIT中有一个项目,其中包含每个作业的子目录。所有任务彼此独立。
我目前的项目结构看起来像这样。
project
assignment 1
main.c
some.c
some.h
Makefile
...
assignment 2
main.c
some.c
some.h
Makefile
...
assignment 3
main.c
some.c
some.h
Makefile
...
...
但是,我无法启动任何主要文件。我在Clion之前使用了VisualStudio代码,不得不创建那些Makefiles以使我的程序运行。我仍然可以使用CLION中的终端使用Make-Command并从那里启动程序,但我希望它们在Crion中正常工作。
我读到Clion使用cmakelist.txt-files,但我对它们不熟悉。我尝试使用源文件顶部的蓝色提示符自动创建它,但是在此之后弹出的窗口都有每个文件夹,并且(几乎)检查了每个文件。我认为这是错误的(我怀疑Clion认为每个目录和每个文件都是一个大型项目的一部分)
我必须如何设置clion/cmakelist.txt才能像我想要的那样工作?子目录是否需要自己的cmakelist.txt?甚至有可能在同一项目中的子目录中具有完全独立的程序吗?
I'm currently a student and need to learn C. I'm working on a Debian Virtual Machine using CLion.
To manage my assignments better, I created a github repository to synchronize and store all my C assignments. So I have one project in git containing sub-directories for every assignment I have to do. All assignments are independent of each other.
My current project structure looks like this.
project
assignment 1
main.c
some.c
some.h
Makefile
...
assignment 2
main.c
some.c
some.h
Makefile
...
assignment 3
main.c
some.c
some.h
Makefile
...
...
However I can not start any of the main.c files. I used VisualStudio Code before CLion and had to create those makefiles to make my programs run. I can still use the terminal in CLion to use the make-command and start the programs from there but I'd like for them to work properly in CLion.
I read that CLion uses CMakeList.txt-files but I'm not familiar with them. I tried to auto-create it using the blue prompt at the top of a source file but the window that pops up after that has every folder and (almost) every file checked. I think this is wrong (I suspect CLion thinks every directory and every file is part of one large project)
CLion create CMakeList.txt
How do I have to set up CLion/CMakeList.txt to work like I want? Does ever sub-directory needs it's own CMakeList.txt? Is it even possible to have completely independent programs in sub-directories within the same project?
发布评论