windows下搭建GUN环境开发C/C++

1.MinGw

        MinGW提供了一套简单方便的Winodows下的基于GCC程序开发环境

        CSDN上有很多资源自己下载,放到某一盘下,这里以C盘为例

        将安装目录下(这里是C:\MinGW\msys\1.0\msys.bat) 发送到桌面快捷方式

        在msys.bat命令框中输入 gcc 会得到:sh: gcc: command not found

        此时并没有配置环境变量

        用编辑器打开 C:\MinGW\msys\1.0\etc\profile

        在最后一行后面加入 export PATH=/C/MinGW/bin:$PATH 保存并重新打开msys.bat

        命令框中输入 cd /c/Users/用户名/Desktop 进入桌面

        (这时用编辑器在桌面上写一个hello.c)

        命令框输入 gcc hello.c 后在桌面会自动生成编译完成的hello.exe

        命令框输入./hello.exe 直接执行hello.exe得到运行结果时表示环境搭建成功

    2.cygwin

        CSDN上资源自己搜索,很多

        完成后,执行桌面快捷方式Cygwin64 Terminal命令框

        命令框输入gcc,提示 “ gcc: 致命错误:没有输入文件 编译中断。 ” 表示gcc已存在,并且还是中文提示

        命令框输入 /cygdrive/c/Users/用户名/Desktop 进入桌面

        (此时用编辑器在桌面上写一个hello.c)

        命令框输入 gcc hello.c 后桌面生成 a.exe

        命令框输入 ./a.exe 得到运行结果时表示环境搭建成功


        附:cmd中若输入Cygwin编译的.exe 将出现系统提示 “无法启动此程序,因为计算机中丢失 cygwin1.dll。尝试重新安装该程序及解决此问题”

        (cygwin1.dll 是cygwin环境里面用来模拟Linux环境的一个动态库,它可以把Linux的API给映射到Windows的API上,来执行Windows的程序)

        两种解决方法:

            ①.在cmd中配置环境变量 set PATH=%PATH%;C\cygwin64\bin

            ②.找到 C\cygwin64\bin下的cygwin.dll并复制到桌面后执行a.exe便可以得到结果

        (cygwin.dll由于包装了很多API而有3mb多的大小,要被cygwin生成的.exe依赖,所以需要将两者放在同一目录下)


    在Windows平台使用Sublime Test开发C语言程序

    官网下载安装Sublime http://www.sublimetext.com/

    编写好的.c文件直接用Sublime菜单栏中Tools下的 Run(快捷键 Ctrl+Shift+B)执行会得到Error 2错误:

    这是因为该情况下Sublime基于Windows平台,没有GNU环境

    因为这里下的是sublime test 2.0.2,所以这时在MinGW或Cygwin中输入 cd /cygdrive/c/Program\ Files/Sublime\ Text\ 2/  

    后输入 run sublime_test.exe 便可在GNU环境下打开Sublime Test 2,此时打开的Sublime Test 便处于GNU环境下


 


  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
windows中打包tar文件 GUN tar 和在unix中使用tar命令基本上一样的。可以使用tar --help得到帮助的详细信息。 ------------------------------------------- GNU `tar' saves many files together into a single tape or disk archive, and can restore individual files from the archive. Usage: tar [OPTION]... [FILE]... If a long option shows an argument as mandatory, then it is mandatory for the equivalent short option also. Similarly for optional arguments. Main operation mode: -t, --list list the contents of an archive -x, --extract, --get extract files from an archive -c, --create create a new archive -d, --diff, --compare find differences between archive and file system -r, --append append files to the end of an archive -u, --update only append files newer than copy in archive -A, --catenate append tar files to an archive --concatenate same as -A --delete delete from the archive (not on mag tapes!) Operation modifiers: -W, --verify attempt to verify the archive after writing it --remove-files remove files after adding them to the archive -k, --keep-old-files don't overwrite existing files when extracting -U, --unlink-first remove each file prior to extracting over it --recursive-unlink empty hierarchies prior to extracting directory -S, --sparse handle sparse files efficiently -O, --to-stdout extract files to standard output -G, --incremental handle old GNU-format incremental backup -g, --listed-incremental handle new GNU-format incremental backup --ignore-failed-read do not exit with nonzero on unreadable files Handling of file attributes: --owner=NAME force NAME as owner for added files --group=NAME force NAME as group for added files --mode=CHANGES force (symbolic) mode CHANGES for added files --atime-preserve don't change acces
GUN 是一个 NoSQL 数据库,C++ 是一种编程语言,它们并不直接相关。如果你想在 C++ 程序中使用 GUN 数据库,可以按照以下步骤在 VScode 中实现 C++GUN 工具环境: 1. 安装 GUN 库:在终端中输入以下命令安装 GUN 库: ``` git clone https://github.com/amark/gun.git cd gun make ``` 这些命令将从 GUN 库的 GitHub 仓库中克隆代码,并编译生成 GUN 库。 2. 创建 C++ 项目:在 VScode 中创建一个新的文件夹,然后在终端中进入该文件夹,输入以下命令创建 C++ 项目: ``` mkdir my-cpp-project cd my-cpp-project g++ main.cpp -o my-cpp-project -lpthread ``` 其中,main.cpp 是你的 C++ 代码文件,my-cpp-project 是你的项目名称。 3. 编写 C++ 代码:在 VScode 中创建一个新的 C++ 文件,然后编写你的 C++ 代码。在代码中包含 GUN 库的头文件,并使用 GUN 库提供的 API 实现数据的读写等操作。 4. 编译 C++ 代码:在终端中输入以下命令编译 C++ 代码: ``` g++ main.cpp -o my-cpp-project -lpthread -L/path/to/gun -I/path/to/gun/include -lstdc++fs -lgun ``` 其中,/path/to/gun 是你的 GUN 库所在路径。编译完成后,会生成一个可执行文件 my-cpp-project。 5. 运行 C++ 程序:在终端中输入以下命令运行 C++ 程序: ``` ./my-cpp-project ``` 其中,my-cpp-project 是你的项目名称。程序运行后,你就可以在终端中看到程序的输出结果了。 这样,你就可以在 VScode 中实现 C++GUN 工具环境了。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值