English 中文(简体)
如何在窗户中开展中线指挥方案?
原标题:How to make a linux command-line program work in windows?

我是方案拟订的开端人,我在乌班图的C/C++做了工作。 当我告诉一些东西去cin/cer子或印刷/扫描,或从指挥线上提出论点时,所有这一切都发生在乌班图角。

Now if I want to run these same programs (very simple programs, beginner-level) and run them in Windows, how do I run them from the Windows command line? A previous course I ve taken had us download cygwin to simulate the linux command line in windows, but what if I want to just run the program from the ordinary windows command line? Is that possible, and does it require modification of the software?

最佳回答

You can cross-compile the program for Windows from linux.

乌班图基本上就是这样:

su mingw32 mingw32-binutils mingw32-runtime

...

i586-mingw32msvc-g++ -o myProgram.exe myProgram.cpp

简便、正确? 谷歌“乌图交叉窗口”,那里有一线信息。

问题回答

It s exactly the same. You run cmd and write the command (almost) exactly as you would in Linux.

例如,如果你建立<编码>program的方案,那么你就会把其操作到像样的六氯环己烷中:

./program --option1 -o2 file1 file2

And in Windows, first you have to make the output have a .exe suffix and then in cmd you would write:

program.exe --option1 -o2 file1 file2

Basically saying, cmd is Windows terminal. It s nowhere near as good as the Linux terminal, but that would be all you get without installing additional software.


cmd)提出申请,你就会看到输入/投递量与你在光线终端站完全相同。 I/O redirection也非常相似。

<代码>cin和coutfscanf,在Windows与在短链氯化石蜡中相同。 (Im pretty cerr) 但这也不意味着100%。 至少,它在那里工作。 最大的区别是,Windows在管理你的节目之前,通常会赢得扩大野心的拖.(如*.txt);在大多数情况下,你必须这样做。

基本上,只要该评估器不使用任何专门针对欧伦特或海合会的物品,你就只能利用你希望测试的任何汇编者,将其重新并入目标机器。

如果你不想再comp......好......。 即使是热带风暴也赢得了本土的六氯环己烷。 你们需要一个装有六氯环己烷的虚拟机器。

When a C program is compiled into an executable this is done in a system dependent way. On Ubuntu the ELF format is used and on Windows we have PE.

当你开始一个进程时,欧洲扫盲运动或PE正在读写指示/地图,说明如何分配历史记录,以及将各种过程列入一个实际的记账表。 此外,该图书馆还连接了有活力的装设图书馆,这些图书馆已经保存在体力上,并与使用同一图书馆的其他进程分享。 或者如果动态图书馆没有配备这些图书馆。 (Burit .so,S.,S.dll)。 如果它有固定的图书馆,则这些图书馆在分配和连接(Birginia .a, 视像仪)。 - 简化。

记忆限制等由以往过程继承。

环境变量被引入这一进程的运行环境。 这是一条道路、论点等。 接着,<代码>main()添加到栏目中并注明。

现在,在主事之前发生的一切都受到呼吁,联系等如何解决,以及许多其他事情都取决于该系统。 正因为如此,人们只能从Windows上操作一个可执行的汇编。

使用<代码>cygwin,只是创造了一种虚拟环境,在这些环境中,这些联系等都是一样的,而且会发挥作用。 一种是造成ELF环境。

要将其连接到本土的Windows指挥线,就必须为Windows编辑。 在这个问题上,我已经看到许多答案。

如同在不同的系统中一样,ELF和PE也有不同的处理环境变量的方法。 这些内容等等。 因此,档案的扩充处理方式不同。 但是,这两个运行过程都有诸如<代码>stderr、stdoutstdin/code>等缺省流。 但below 您在C中的代码并不相同。

它就像驾驶柴油汽车。 情况大体相同,但在一生中,有几处不同。

了解,即信号在Windows上处理不同。





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?