现在的位置: 首页 > 操作系统 > 正文

使用CLion编辑C工程

2020年02月10日 操作系统 ⁄ 共 1028字 ⁄ 字号 评论关闭

最近正在研究Linux C代码编辑器,确实也不太喜欢SI(Windows看代码还行,编辑一般,同步麻烦),尝试使用CLion,但对makefile工程支持不好,怎么编译还没搞懂,阅读、编辑还不错,智能提示、语法检查、函数跳转、查引用都挺好用的。

不过要想使用CLion的这些功能需要添加工程中的h文件到CMakeList.txt,可参考如下脚本(把print结果添到CMakeList.txt里就行)

#!/usr/bin/env Python# -*- coding: utf-8 -*-import fnmatchimport osimport sysdef find_file(path, file_exp): for r, d, f in os.walk(path): for n in fnmatch.filter(f, file_exp): yield os.path.join(r, n)if __name__ == '__main__': if len(sys.argv) != 2: print('Usage: python get_h_cmakelist.py path_to_your_project') exit(-1) project_path= sys.argv[1] h_dir= [] for file in find_file(project_path, '*.h'): file_dir= os.path.dirname(file) if file_dir not in h_dir: h_dir.append(file_dir) print('include_directories({0})'.format('\r\n\t'.join(h_dir)))

结果类似

include_directories(E:\ids\suricata-3.1.2\libhtp\htp E:\ids\suricata-3.1.2\libhtp\test E:\ids\suricata-3.1.2\libhtp\test\gtest E:\ids\suricata-3.1.2\src)

本文永久更新链接地址:http://www.xuebuyuan.com/Linux/2017-03/141386.htm

以上就上有关使用CLion编辑C工程的相关介绍,要了解更多CLion,Linux C,使用CLion编辑C工程,编程,Linux编程,Linux Shell,Android,Android教程,JAVA,C语言,Python,HTML5内容请登录学步园。

抱歉!评论已关闭.