mingw

让Sublime Text 2运行程序时弹出命令行窗口

青春壹個敷衍的年華 提交于 2020-02-26 14:40:20
Sublime Text 2功能非常强大,但是使用Sublime Text 2编写和编译,然后运行程序时,运行结果直接显示在Sublime Text 2中,如果需要从命令行输入数据,将无能为力,而且会提示报错。 我查了sublime text 2官网的说明,有这么一段: shell:Optional. If true, cmd will be run through the shell (cmd.exe, bash…) .大意应该是在编译配置文件中加上“shell”:true就可以让程序在shell中运行,但是我试了,无论是windows还是linux(Xubuntu),java,c或者python都不行,只有C语言中有点反应,没有看到shell窗口,但是启用这一选项之后,sublime text 2的输出栏目中也看不到运行结果了。 解决方法:使用批处理文件。本解决方法以C语言程序为例,编译器是gcc,我下载了MINGW直接解压到C盘根目录下,并设置了相应的PATH。其它编程语言可以按照这个思路适当修改批处理文件。 新建两个批处理文件,一个名为runp.bat,内容如下: @echo off %1 pause exit 一个为callrunp.bat,内容如下: @echo off start runp.bat %1 这两个bat文件放到系统路径下。我将这两个bat文件放到了c:

Linux命令以树形式打印目录结构

纵然是瞬间 提交于 2020-02-26 10:45:06
我可以从Bash脚本中调用任何Linux命令吗,它将以树的形式打印目录结构,例如, folder1 a.txt b.txt folder2 folder3 #1楼 要将Hassou的解决方案添加到您的.bashrc,请尝试: alias lst='ls -R | grep ":$" | sed -e '"'"'s/:$//'"'"' -e '"'"'s/[^-][^\/]*\//--/g'"'"' -e '"'"'s/^/ /'"'"' -e '"'"'s/-/|/'"'" #2楼 您可以使用以下一种: ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/' 它将 在几秒钟内 显示当前子目录的图形表示而没有文件,例如在/ var / cache /中 : . |-apache2 |---mod_cache_disk |-apparmor |-apt |---archives |-----partial |-apt-xapian-index |---index.1 |-dbconfig-common |---backups |-debconf 资源 #3楼 这是您要寻找的 树 吗? 它应该在大多数发行版中(可能是可选安装)。 ~> tree -d /proc/self/

Go实现的库的跨平台编译调用

Deadly 提交于 2020-02-26 10:30:38
通过cgo可以将go的程序编译成库,在其他程序,如C程序中调用。cgo本身就提供了多平台的支持。不过对于每个平台还需要有相应的C编译工具链的支持,对不同平台的支持程度也不一致,需要针对每个平台单独处理。 新建文件 lib.go ,通过import C启用cgo,export指定需要导出的方法。cgo编译后会生成相应的头文件,在C程序中包含这个头文件,链接时链接生成的库即可使用。 package main import "C" //export add func add(a, b C.int) C.int { return a + b } func main() { } 编译Linux平台的库 Linux平台的编译最为顺利,有其实就在Linux上操作,只要安装gcc即可。 安装C编译器 因为本身就64位的系统,默认安装gcc即可,如果需要编译32位的库,则需要单独安装针对32位版本的gcc。 $ sudo apt install gcc 编译静态库 $ CGO_ENABLED=1 GOOS=linux GOARCH=amd64 CC=gcc go build -buildmode=c-archive -o libcgotest.a lib.go 编译动态库 $ CGO_ENABLED=1 GOOS=linux GOARCH=amd64 CC=gcc go build

如何使用POSIX在C ++中执行命令并获取命令的输出?

﹥>﹥吖頭↗ 提交于 2020-02-26 08:24:20
我正在寻找一种从C ++程序中运行时获取命令输出的方法。 我已经看过使用 system() 函数,但这只会执行一个命令。 这是我要寻找的示例: std::string result = system("./some_command"); 我需要运行任意命令并获取其输出。 我查看了 boost.org ,但没有找到任何 可以满足 我需求的东西。 #1楼 使用我的 pstreams 标头轻松获取stdout和stderr(以及写入stdin,此处未显示)很容易,它定义了像 popen 一样工作的iostream类: #include <pstream.h> #include <string> #include <iostream> int main() { // run a process and create a streambuf that reads its stdout and stderr redi::ipstream proc("./some_command", redi::pstreams::pstdout | redi::pstreams::pstderr); std::string line; // read child's stdout while (std::getline(proc.out(), line)) std::cout << "stdout: " <<

Git 介绍和日常命令

不问归期 提交于 2020-02-25 23:49:29
git 介绍 GitHub是一个面向开源及私有软件项目的托管平台,因为只支持git 作为唯一的版本库格式进行托管,故名GitHub。 GitHub于2008年4月10日正式上线,除了Git代码仓库托管及基本的 Web管理界面以外,还提供了订阅、讨论组、文本渲染、在线文件编辑器、协作图谱(报表)、代码片段分享(Gist)等功能。目前,其注册用户已经超过350万,托管版本数量也是非常之多,其中不乏知名开源项目 Ruby on Rails、jQuery、python 等。 2018年6月4日,微软宣布,通过75亿美元的股票交易收购代码托管平台GitHub。 2019年05月,《个人电脑杂志》网站报道,GitHub正遭到一名黑客的入侵。据称,这名黑客先擦除代码资源库,然后向用户索要赎金,作为恢复数据的交换。 git 功能 分布式版本控制; 多个开发人员协调工作; 有效监听谁做的修改; 本地以及远程操作; git 日常命令 git Basic Order git init // 初始化本地仓库 git add // 添加文件 git status // 查看状态 git commit // 提交 git push // 推送到仓库 git pull // 从远程仓库拉取数据 git clone // 从远程仓库拷贝数据 git install https://git-scm.com

mingw32/bin/ld.exe … undefined reference to [class] … collect2.exe: error: ld returned 1 exit status

让人想犯罪 __ 提交于 2020-02-25 09:43:12
问题 Problem description while I am trying to move my code from Linux to Windows: MinGW on Windows linker problems happens when I am calling a user-defined class inside my Main.cpp ( works fine if I do not call the user-defined class constructor in Main ) Relevant code samples: Person.hpp class Person { public: Person(const string& iName, const list<string>& iContactDetails, ); virtual ~Person(); ... Main.cpp #include "Person.hpp" ... int main() { ... Person myPerson = Person (myName,

Building Cairo for Windows with MinGW (Problems linking libpng)

一笑奈何 提交于 2020-02-24 07:00:28
问题 I'm trying to build cairo on Windows using MinGW (and MSYS). I am following the instrucions on Compiling GTK+ 2.16.4 for Windows, except that I'm using the latest versions whenever possible, i.e: zlib-1.2.3 libpng-1.2.42 pixman-0.17.4 cairo-1.8.8 This works pretty well up until when I try to build the actual cairo. The configuration succeeds, but during make cairo seems to have problems linking to my build of libpng. After a little while I get a long list of errors such as this: .libs/cairo

windows下搭建ffmpeg环境

给你一囗甜甜゛ 提交于 2020-02-23 11:51:53
在windows下编译ffmpeg可以采用cygwin或msys+mingw两种方案,我个人比较喜欢msys+mingw方式,因为这样可以在windows下搭建一个类Unix操作系统,并且配置比cygwin要简单,因此本就是描述怎样建立msys+mingw的环境。 在windows下搭建ffmpeg编译环境在网上的文章很多,最为详细的可能是这篇文章: http://ffmpeg.arrozcru.org/wiki/index.php?title=Main_Page 。但是在由于版本问题,完全按照上面的描述是通不过的。 到 http://sourceforge.net/projects/mingw/files/ 下载最新版MinGW安装程序,我的是MinGW-5.1.6.exe 到 http://sourceforge.net/projects/mingw/files/MSYS%20Base%20System/msys-1.0.11/MSYS-1.0.11.exe/download 下载MSYS-1.0.11,注意当前MSYS已经是1.0.14版,但是从1.0.11版之后,就再也没有安装程序了 到 http://prdownloads.sourceforge.net/mingw/coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2?download

How to link to an xxx.dll when the provider only ships it with an xxx.lib and you are using MinGW-w64 and not MSVC?

こ雲淡風輕ζ 提交于 2020-02-23 07:50:29
问题 Firebird and Boost communities only provide the xxx.lib for their pre-built xxx.dll binaries, and I am using MinGW-w64 v7.0.0 with GCC v8.1.0 , and this last one expects a libxxx.a file containing all the xxx.dll function symbols to link with. For Boost , I can build it from the source code for MinGW-w64 (though I still prefer using the pre-built ones, because the build process for big toolkits like this one takes forever). As for Firebird , it is not buildable using MinGW-w64 at all, except

How do you configure Msys's default size, color, and font?

。_饼干妹妹 提交于 2020-02-18 04:05:12
问题 I've been exploring use of MSys lately as an alternative, 'nix-like shell for my windows development. However, the default colors and size are driving me crazy. Anyone have any idea as to how I can change the default size, color, and / or font? Honestly, I'd be happy if I could make the default character width/height of the shell larger, but the others would be nice too... Clarification: the msys shell is a separate app from the windows shell - the normal 'right-click-upper-left -> properties