文章目录

官方文档:https://code.visualstudio.com/docs/cpp/config-clang-mac
安装 C/C++ 编程常用扩展插件:
检查 MacOS 上的 Clang/LLVM 环境。
$ clang --version
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: x86_64-apple-darwin21.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

VS Code Server 是一个 VS Code 的远程开发工具,可以让用户在远程计算机上使用 VS Code 编辑器的功能。使用 VS Code Server 可以让用户在本地电脑上使用轻量级的 VS Code 客户端,而将开发环境部署到远程服务器上,这样可以减轻本地计算机的负担,同时也可以让多个用户协同编辑同一个项目。
VS Code Server 通过在远程计算机上运行一个简单的 Web 服务来实现。用户可以通过 VS Code 客户端连接到该服务,从而在远程计算机上使用 VS Code 编辑器的功能。
此外,VS Code Server 还支持与容器化的开发环境集成,使得开发者可以在容器中进行远程开发。
获取 VS Code 客户端的 commit ID,e.g. 5e805b79fcb6ba4c2d23712967df89a089da575b

浏览器下载 commit ID 对应的 vscode-server-linux-x64.tar.gz 安装包。
# https://update.code.visualstudio.com/commit:{commit_id}/server-linux-x64/stable
https://update.code.visualstudio.com/commit:5e805b79fcb6ba4c2d23712967df89a089da575b/server-linux-x64/stable
remote$ mkdir -p ~/.vscode-server/bin
local $ scp vscode-server-linux-x64.tar.gz root@192.168.1.3:~/.vscode-server/bin
$ cd ~/.vscode-server/bin
$ tar -zxvf vscode-server-linux-x64.tar.gz
$ mv vscode-server-linux-x64 5e805b79fcb6ba4c2d23712967df89a089da575b
$ rm -rf vscode-server-linux-x64.tar.gz
$ cd 5e805b79fcb6ba4c2d23712967df89a089da575b
$ touch 0
Client 连接 Server。

一键安装 Local 的扩展到 Remote。

Open Folder 开发 Remote 的文件目录。


{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/opt/dpdk-18.08/x86_64-native-linuxapp-gcc/include", // 添加第三方库的 include 路径。
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c11",
"cppStandard": "c++14",
"intelliSenseMode": "linux-gcc-x64",
"configurationProvider": "ms-vscode.makefile-tools"
}
],
"version": 4
}
yum install global -y
$ cd your_project_folder
$ gtags
$ code .

$ mkdir /workspace/projects
$ cd /workspace/projects
$ mkdir helloworld
$ cd helloworld
$ code .
使用 code 指令将该目录定义为一个代码项目的工作目录,在该目录下我们会创建 1 个 VS code 代码项目专有的配置目录 .vscode,包含了以下 3 个文件:
创建 C/C++ 源码文件:
#include <iostream>
int main()
{
for (int i=0; i<3; i++)
{
std::cout << "hello world" << std::endl;
}
return 0;
}
运行并查看输出:

第一次运行后会自动生成 tasks.json 文件,设置了代码编译和构建的配置参数。
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: clang++ 生成活动文件",
"command": "/usr/bin/clang++",
"args": [
"-fcolor-diagnostics",
"-fansi-escape-codes",
"-g",
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "调试器生成的任务。"
}
],
"version": "2.0.0"
}
/usr/bin/clang++ -fcolor-diagnostics -fansi-escape-codes -g /workspace/projects/helloworld/helloworld.cpp -o /workspace/projects/helloworld/helloworld
单击行号插入 breakpoint。

进入调试界面开始调试:

在需要自定义 debug 流程的场景中,可以通过添加 launch.json 配置文件来完成。
{
"configurations": [
{
"name": "C/C++: clang++ 生成和调试活动文件",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/${fileBasenameNoExtension}",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [],
"externalConsole": false,
"MIMode": "lldb",
"preLaunchTask": "C/C++: clang++ 生成活动文件"
}
],
"version": "2.0.0"
}
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Debug",
"program": "${fileDirname}/${fileBasenameNoExtension}.out",
"args": [],
"cwd": "${workspaceFolder}"
}
]
}
最后,针对 C/C++ 的诸多扩展内容,我们可以通过 UI 的方式来设置相关的配置,同时会自动生成 c_cpp_properties.json 文件。

我想为Heroku构建一个Rails3应用程序。他们使用Postgres作为他们的数据库,所以我通过MacPorts安装了postgres9.0。现在我需要一个postgresgem并且共识是出于性能原因你想要pggem。但是我对我得到的错误感到非常困惑当我尝试在rvm下通过geminstall安装pg时。我已经非常明确地指定了所有postgres目录的位置可以找到但仍然无法完成安装:$envARCHFLAGS='-archx86_64'geminstallpg--\--with-pg-config=/opt/local/var/db/postgresql90/defaultdb/po
我打算为ruby脚本创建一个安装程序,但我希望能够确保机器安装了RVM。有没有一种方法可以完全离线安装RVM并且不引人注目(通过不引人注目,就像创建一个可以做所有事情的脚本而不是要求用户向他们的bash_profile或bashrc添加一些东西)我不是要脚本本身,只是一个关于如何走这条路的快速指针(如果可能的话)。我们还研究了这个很有帮助的问题:RVM-isthereawayforsimpleofflineinstall?但有点误导,因为答案只向我们展示了如何离线在RVM中安装ruby。我们需要能够离线安装RVM本身,并查看脚本https://raw.github.com/wayn
我正在编写一个包含C扩展的gem。通常当我写一个gem时,我会遵循TDD的过程,我会写一个失败的规范,然后处理代码直到它通过,等等......在“ext/mygem/mygem.c”中我的C扩展和在gemspec的“扩展”中配置的有效extconf.rb,如何运行我的规范并仍然加载我的C扩展?当我更改C代码时,我需要采取哪些步骤来重新编译代码?这可能是个愚蠢的问题,但是从我的gem的开发源代码树中输入“bundleinstall”不会构建任何native扩展。当我手动运行rubyext/mygem/extconf.rb时,我确实得到了一个Makefile(在整个项目的根目录中),然后当
我有一个奇怪的问题:我在rvm上安装了rubyonrails。一切正常,我可以创建项目。但是在我输入“railsnew”时重新启动后,我有“程序'rails'当前未安装。”。SystemUbuntu12.04ruby-v"1.9.3p194"gemlistactionmailer(3.2.5)actionpack(3.2.5)activemodel(3.2.5)activerecord(3.2.5)activeresource(3.2.5)activesupport(3.2.5)arel(3.0.2)builder(3.0.0)bundler(1.1.4)coffee-rails(
我刚刚为fedora安装了emacs。我想用emacs编写ruby。为ruby提供代码提示、代码完成类型功能所需的工具、扩展是什么? 最佳答案 ruby-mode已经包含在Emacs23之后的版本中。不过,它也可以通过ELPA获得。您可能感兴趣的其他一些事情是集成RVM、feature-mode(Cucumber)、rspec-mode、ruby-electric、inf-ruby、rinari(用于Rails)等。这是我当前用于Ruby开发的Emacs配置:https://github.com/citizen428/emacs
我正在尝试在我的centos服务器上安装therubyracer,但遇到了麻烦。$geminstalltherubyracerBuildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingtherubyracer:ERROR:Failedtobuildgemnativeextension./usr/local/rvm/rubies/ruby-1.9.3-p125/bin/rubyextconf.rbcheckingformain()in-lpthread...yescheckingforv8.h...no***e
我有一个在Linux服务器上运行的ruby脚本。它不使用rails或任何东西。它基本上是一个命令行ruby脚本,可以像这样传递参数:./ruby_script.rbarg1arg2如何将参数抽象到配置文件(例如yaml文件或其他文件)中?您能否举例说明如何做到这一点?提前谢谢你。 最佳答案 首先,您可以运行一个写入YAML配置文件的独立脚本:require"yaml"File.write("path_to_yaml_file",[arg1,arg2].to_yaml)然后,在您的应用中阅读它:require"yaml"arg
我的最终目标是安装当前版本的RubyonRails。我在OSXMountainLion上运行。到目前为止,这是我的过程:已安装的RVM$\curl-Lhttps://get.rvm.io|bash-sstable检查已知(我假设已批准)安装$rvmlistknown我看到当前的稳定版本可用[ruby-]2.0.0[-p247]输入命令安装$rvminstall2.0.0-p247注意:我也试过这些安装命令$rvminstallruby-2.0.0-p247$rvminstallruby=2.0.0-p247我很快就无处可去了。结果:$rvminstall2.0.0-p247Search
我实际上是在尝试使用RVM在我的OSX10.7.5上更新ruby,并在输入以下命令后:rvminstallruby我得到了以下回复:Searchingforbinaryrubies,thismighttakesometime.Checkingrequirementsforosx.Installingrequirementsforosx.Updatingsystem.......Errorrunning'requirements_osx_brew_update_systemruby-2.0.0-p247',pleaseread/Users/username/.rvm/log/138121
由于fast-stemmer的问题,我很难安装我想要的任何rubygem。我把我得到的错误放在下面。Buildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingfast-stemmer:ERROR:Failedtobuildgemnativeextension./System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/rubyextconf.rbcreatingMakefilemake"DESTDIR="cleanmake"DESTDIR=