用Xcode配置完美ACMer环境
用Xcode配置完美ACMer环境
前言
作为\(ACMer\),需求大致为强大的文本编辑功能\((VIM)\),便捷的文件模版功能以及多文件编译功能。\(vscode\)虽然强大,但是与集成\(IDE\)相比其缺点也很明显,就是没有完美的\(Debug\)功能。而\(Xcode\)刚好有此功能,但是在其他方面却显得有些笨拙,经过在网上探查,逐步实现了\(Xcode+vim+多文件编译 +自定义模版\)等功能。下面就来一一介绍如何配置。
万能头文件
打开\(Finder\)
按快捷键:\(Command+Shift+G\)。
输入路径:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1
创建名为"bits"的文件夹
创建名为"stdc++.h"的文件
文件中写入以下代码:
// C++ includes used for precompiling -*- C++ -*-
// Copyright (C) 2003-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file stdc++.h
* This is an implementation file for a precompiled header.
*/
// 17.4.1.2 Headers
// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
//#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
- 保存退出即可。
Vim插件
- 首先确认\(Xcode\)处于关闭状态
- 因为\(Vim\)插件属于第三方软件,所以需要给其注册一个证书:
# 下载注册软件
git clone https://github.com/slegetank/ResignXcode.git
# 进入安装目录
cd ResignXcode
# 运行注册程序
python2.7 ResignXcode.py
- 等待,可能时间比较长
- 安装\(Vim\)插件:
# 确认 Xcode 指向 /Applications/Xcode.app/Contents/Developer
xcode-select -p
# 下载 XVim2
git clone https://github.com/XVimProject/XVim2.git
# 下载完毕后,进入目录
cd xvim2
# 安装
make
安装完成后显示\(BUILD\ SUCCEEDED\)则表示安装成功。
打开\(Xcode\)提示
Unexpected code bundle "XXVim2.xcpplugin,选择Load Bundle即可。
自定义模版格式
- 打开\(Finder\)。
- 按快捷键:\(Command+Shift+G\)
- 输入文件路径:
/Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/Project Templates/Mac/Application/Command Line Tool.xctemplate
- 复制文件\(TemplateInfo.plist\)到以下目录中:(没有文件夹的需要创建文件夹)
~/Library/Developer/Xcode/Templates/Application/My Command Line Tool.xctemplate
- 修改\(TemplateInfo.plist\)文件:(根据需要自行修改第\(100\)行和最后一段)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Kind</key>
<string>Xcode.Xcode3.ProjectTemplateUnitKind</string>
<key>Identifier</key>
<string>com.apple.dt.unit.commandLineTool</string>
<key>Ancestors</key>
<array>
<string>com.apple.dt.unit.base</string>
<string>com.apple.dt.unit.osxBase</string>
</array>
<key>Concrete</key>
<true/>
<key>SortOrder</key>
<integer>50</integer>
<key>Description</key>
<string>This template creates a command-line tool.</string>
<key>Targets</key>
<array>
<dict>
<key>ProductType</key>
<string>com.apple.product-type.tool</string>
<key>TargetIdentifier</key>
<string>com.apple.dt.commandLineToolTarget</string>
<key>BuildPhases</key>
<array>
<dict>
<key>Class</key>
<string>Sources</string>
</dict>
<dict>
<key>Class</key>
<string>Frameworks</string>
</dict>
<dict>
<key>Class</key>
<string>CopyFiles</string>
<key>DstPath</key>
<string>/usr/share/man/man1/</string>
<key>DstSubfolderSpec</key>
<string>0</string>
<key>RunOnlyForDeploymentPostprocessing</key>
<string>YES</string>
</dict>
</array>
</dict>
</array>
<key>Options</key>
<array>
<dict>
<key>Identifier</key>
<string>languageChoice</string>
<key>Name</key>
<string>Language:</string>
<key>Description</key>
<string>The primary implementation language for the command-line tool</string>
<key>Default</key>
<string>Swift</string>
<key>Type</key>
<string>popup</string>
<key>Values</key>
<array>
<string>Swift</string>
<string>Objective-C</string>
<string>C++</string>
<string>C</string>
</array>
<key>Units</key>
<dict>
<key>C</key>
<dict>
<key>Nodes</key>
<array>
<string>main.c:comments</string>
<string>main.c:include</string>
<string>main.c:main:content</string>
</array>
<key>Definitions</key>
<dict>
<key>main.c:include</key>
<string>#include <stdio.h>
</string>
<key>main.c:main:content</key>
<string>// insert code here...
printf("Hello, World!\n");
return 0;
</string>
</dict>
</dict>
<key>C++</key>
<dict>
<key>Nodes</key>
<array>
<string>main.cpp:include</string>
<string>main.cpp:main:content</string>
</array>
<key>Definitions</key>
<dict>
<key>main.cpp:include</key>
<string>#include <bits/stdc++.h>
using namespace std;
typedef int Int;
#define int long long
#define INF 0x3f3f3f3f
#define maxn 200000
int a[maxn];</string>
<key>main.cpp:main:content</key>
<string>ios::sync_with_stdio(false);
cin.tie(0);
return 0;
</string>
</dict>
</dict>
<key>Objective-C</key>
<dict>
<key>Nodes</key>
<array>
<string>main.m:comments</string>
<string>main.m:include</string>
<string>main.m:main:content</string>
</array>
<key>Definitions</key>
<dict>
<key>main.m:include</key>
<string>#import <Foundation/Foundation.h>
</string>
<key>main.m:main:content</key>
<string>@autoreleasepool {
// insert code here...
NSLog(@"Hello, World!");
}
return 0;
</string>
</dict>
</dict>
<key>Swift</key>
<dict>
<key>Project</key>
<dict>
<key>Configurations</key>
<dict>
<key>Debug</key>
<dict>
<key>SWIFT_OPTIMIZATION_LEVEL</key>
<string>-Onone</string>
</dict>
<key>Release</key>
<dict>
<key>SWIFT_COMPILATION_MODE</key>
<string>wholemodule</string>
<key>SWIFT_OPTIMIZATION_LEVEL</key>
<string>-O</string>
</dict>
</dict>
</dict>
<key>Targets</key>
<array>
<dict>
<key>SharedSettings</key>
<dict>
<key>SWIFT_VERSION</key>
<string>5.0</string>
</dict>
</dict>
</array>
<key>Nodes</key>
<array>
<string>main.swift:comments</string>
<string>main.swift:include</string>
<string>main.swift:main:content</string>
</array>
<key>Definitions</key>
<dict>
<key>main.swift:include</key>
<string>import Foundation
</string>
<key>main.swift:main</key>
<dict>
<key>Beginning</key>
<string></string>
<key>End</key>
<string></string>
</dict>
<key>main.swift:main:content</key>
<string>print("Hello, World!")
</string>
</dict>
</dict>
</dict>
</dict>
</array>
<key>Definitions</key>
<dict>
<key>*:main</key>
<dict>
<key>Beginning</key>
<string>signed main() {</string>
<key>End</key>
<string>}</string>
<key>Indent</key>
<integer>1</integer>
</dict>
</dict>
</dict>
</plist>
多文件编译
- 正常创建工程即可,当需要创建第二个文件时选择\(File->New->Target\)。然后正常创建一个\(Console\)文件。编译运行的时候,在窗口左上角选择要运行的文件即可。
用Xcode配置完美ACMer环境的更多相关文章
- 2016年最新mac下vscode配置golang开发环境支持debug
网上目前还找不到完整的mac下golang环境配置支持,本人配置成功,现在整理分享出来. mac最好装下xcode,好像有依赖关系安装Homebrew打开终端窗口, 粘贴脚本执行/usr/bin/ru ...
- 越狱开发:用iosOpenDev配置越狱开发环境 编写第一个hello world-b
上网搜索越狱环境搭建,查到iosOpenDev软件,是个很方便的编写插件,而且可以直接用Xcode创建的工具,便开始着手学习如何去安装 集合了网上的方法后,我安装的时候发现: 1.作者最后更新的时间是 ...
- macOS Mojave配置OpenGL开发环境
---恢复内容开始--- 前言: 本文写作目的: 是由于本人参考 csdn原文 的方法配置环境时踩了很多坑,所以在此写一篇文防止以后用到. 工具: Xcode CMake 步骤: 准备工作: Xcod ...
- 安装与配置Flutter开发环境
这篇博客我们介绍了Flutter,并且对比了H5,React Native,Flutter. 由于Flutter是跨平台的开发框架,开发一次可以同时运行在Android和iOS上面,所以我们开发时最好 ...
- Mac使用Xcode配置openGL
Mac使用Xcode配置openGL 博主这学期有图形学课要用到OpenGL,于是首先就开始配置开发环境了.应该说网上Windows上配置OpenGL教程比较多,Mac版的比较少.博主特来分享配置过程 ...
- 【OS X系统】Xcode中搭建Python环境。
虽然按照网上教程一步一步来,但还是遇到了几个错误点,现整理出来,主要是自己做个笔记,同时也希望能帮助到其他像我一样第一次在Xcode上搭建Python环境的人.首先感谢原作者:https://zhid ...
- 配置OpenCV+VS2013环境
配置OpenCV+VS2013环境 准备工作 win7系统 下载opencv的windows编译版 安装vs2013 express 设定环境变量 按windows窗键输入path,选择第二个结果编辑 ...
- 在 IntelliJ IDEA 中配置 JSF 开发环境的入门详解
JSF 作为 JavaEE 官方标准,在了解并掌握其基本开发技术后,对于功能要求较高.业务流程复杂的各种现代 Web 应用程序开发将会成为非常合适且强大的高效率开发利器.JSF 的开发环境搭建涉及到在 ...
- Mac上通过docker配置PHP开发环境
这篇文章介绍的内容是关于Mac上通过docker配置PHP开发环境,有着一定的参考价值,现在分享给大家,有需要的朋友可以参考一下 更多PHP相关知识请关注我的专栏PHPzhuanlan.zhihu. ...
随机推荐
- APP排查内存泄漏最简单和直观的方法
内存泄漏无疑会严重影响用户体验,一些本应该废弃的资源和对象无法被释放,导致手机内存的浪费,app使用的卡顿,那么如何排查内存泄漏呢? 当然,首先我们有google的官方文档可以参考,大部分博客 ...
- 非常好用的JavaScript 工具库--lodash
一.什么是lodash? lodash库是一个具有一致接口.模块化.高性能等特性的 JavaScript 工具库. lodash是一个javascript库,也是Node JS的常用模块,它内部封装了 ...
- LeetCode 279. 完全平方数(Perfect Squares) 7
279. 完全平方数 279. Perfect Squares 题目描述 给定正整数 n,找到若干个完全平方数(比如 1, 4, 9, 16, ...)使得它们的和等于 n.你需要让组成和的完全平方数 ...
- Quartz.Net—JobBuilder
JobBuilder JobBuilder是一个建造者模式,链式建造.通过静态方法构建一个JobBuilder实例,然后再调用类方法Build()创建一个IJobDetail的实现. 1.静态方法 p ...
- C#中HttpWebRequest、WebClient、HttpClient的使用
HttpWebRequest: 命名空间: System.Net,这是.NET创建者最初开发用于使用HTTP请求的标准类.使用HttpWebRequest可以让开发者控制请求/响应流程的各个方面,如 ...
- 有关同时进行两条线路的四维dp
今天发现自己完全对这种dp没有思路……我果然太蒻了./落泪.jpg 对于一个N*N的方格图中选择两条线路从左上角到右下角,其实只要用一个数组f[i][j][p][q]记录一个人走到(i,j)另一个人走 ...
- PAT(B) 1064 朋友数(Java)
题目链接:1064 朋友数 (20 point(s)) 题目描述 如果两个整数各位数字的和是一样的,则被称为是"朋友数",而那个公共的和就是它们的"朋友证号". ...
- C++语言动态创建对象
焦头烂额的考试月终于过去了,终于有时间能停下来思考记录一下这一个月学过的东西,首先先总结一下,在自己仿写魂斗罗游戏时遇见的问题之一,人物在移动的时候如何去判断什么时候掉入水中显示水中画面,什么时候敌人 ...
- go语言实现单链表
线性表包含两种存储方法:顺序存储结构和链式存储结构,其中顺序表的缺点是不便插入与删除数据. 单链表:每个结点包含两部分:数据域+指针域,上一个结点的指针指向下一结点,依次相连,形成链表.特别注意的是每 ...
- javascript之防抖与节流
防抖 你是否在日常开发中遇到一个问题,在滚动事件中需要做个复杂计算或者实现一个按钮的防二次点击操作. 这些需求都可以通过函数防抖动来实现.尤其是第一个需求,如果在频繁的事件回调中做复杂计算,很有可能导 ...