Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/68.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何制作devc++;OnWine(Ubuntu)在编译后自动启动 我想尝试一些只能在Windows中使用的C库,这样我就安装了酒并安装了DEVC++。p>_C_Ubuntu_Dev C++_Wine - Fatal编程技术网

如何制作devc++;OnWine(Ubuntu)在编译后自动启动 我想尝试一些只能在Windows中使用的C库,这样我就安装了酒并安装了DEVC++。p>

如何制作devc++;OnWine(Ubuntu)在编译后自动启动 我想尝试一些只能在Windows中使用的C库,这样我就安装了酒并安装了DEVC++。p>,c,ubuntu,dev-c++,wine,C,Ubuntu,Dev C++,Wine,与windows不同,在我编译并运行之后,它成功地生成/编译为“exe”,但cmd没有显示 我找到了一种方法,通过启动终端并将 $wine cmd $myc.exe 它可以工作,但手动启动“exe”需要时间 < >我如何让DEV C++在葡萄酒中自动找到CMD并执行编译的代码? 先谢谢你 默认情况下,Dev-C++依赖一个名为ConsolePauser.exe的简单文件。此文件调用已编译的.exe文件,并在0.xxxxx秒后以返回值x退出熟悉的进程。在退出后发出通知 但是,ConsolePa

与windows不同,在我编译并运行之后,它成功地生成/编译为“exe”,但cmd没有显示

我找到了一种方法,通过启动终端并将

$wine cmd $myc.exe

它可以工作,但手动启动“exe”需要时间

< >我如何让DEV C++在葡萄酒中自动找到CMD并执行编译的代码?
先谢谢你

默认情况下,Dev-C++依赖一个名为
ConsolePauser.exe的简单文件。此文件调用已编译的
.exe
文件,并在0.xxxxx秒后以返回值x退出熟悉的
进程。
在退出后发出通知

但是,
ConsolePauser.exe
是一个本地Windows二进制文件,除非Wine调用,否则无法在Ubuntu中执行。另外,
ConsolePauser
调用可执行文件的裸名称,而不是调用Wine,这是必需的

因此,要使Dev-C++在按下
F9
后自动运行
.exe
文件,需要做的是构建自己的ConsoleUser。事实上,这很简单:

#include <chrono>
#include <iostream>
#include <string>

int main(int agrc, char ** argv)
{
    using namespace std;
    string s = argv[1];
    string s1;
    for (const auto & ss : s)
    {
        if ((ss == ' ') || (ss == '\\')) s1.push_back('\\');
        s1.push_back(ss);
    }
    s = "wine " + s1;
    auto begin = chrono::high_resolution_clock::now();
    auto retVal = system(s.c_str());
    auto end = chrono::high_resolution_clock::now();
        
    cout << "-------------------------------------" << endl;
    cout << "Process completed after " << chrono::duration_cast<chrono::milliseconds>(end - begin).count();
    cout << " milliseconds with return value " << retVal << "." << endl;
    cout << "Press any key to continue. . ." << endl;
    
    cin.get();
    
    return 0;
}

将这两个文件放在
路径中的同一文件夹中,熟悉的旧控制台暂停器将像一个符咒一样工作。

Dev-C++默认情况下依赖于名为
ConsolePauser.exe的简单文件。此文件调用已编译的
.exe
文件,并在0.xxxxx秒后以返回值x退出熟悉的
进程。
在退出后发出通知

但是,
ConsolePauser.exe
是一个本地Windows二进制文件,除非Wine调用,否则无法在Ubuntu中执行。另外,
ConsolePauser
调用可执行文件的裸名称,而不是调用Wine,这是必需的

因此,要使Dev-C++在按下
F9
后自动运行
.exe
文件,需要做的是构建自己的ConsoleUser。事实上,这很简单:

#include <chrono>
#include <iostream>
#include <string>

int main(int agrc, char ** argv)
{
    using namespace std;
    string s = argv[1];
    string s1;
    for (const auto & ss : s)
    {
        if ((ss == ' ') || (ss == '\\')) s1.push_back('\\');
        s1.push_back(ss);
    }
    s = "wine " + s1;
    auto begin = chrono::high_resolution_clock::now();
    auto retVal = system(s.c_str());
    auto end = chrono::high_resolution_clock::now();
        
    cout << "-------------------------------------" << endl;
    cout << "Process completed after " << chrono::duration_cast<chrono::milliseconds>(end - begin).count();
    cout << " milliseconds with return value " << retVal << "." << endl;
    cout << "Press any key to continue. . ." << endl;
    
    cin.get();
    
    return 0;
}

将这两个文件放在
路径中的同一文件夹中,熟悉的旧控制台暂停器将像一个符咒一样工作。

OT:about:
printf(“Hello World!”)
这将文本输出到
stdout
I/O输出流,但不会将其传递到终端。(退出程序将刷新<代码> StdOUT//COD> S>代码> PrtTf(“Hello World!”); TRAAM到终端。建议:<代码> PrtTf(“Hello World!\n”);< /C> >“\n”将导致I/O流<代码> STDUD//COD>立即被刷新到DeV C++下的一个按钮。(我认为这是
execute
按钮)将运行程序ot:建议使用
project
按钮创建一个包含所有项目子目录的唯一目录,将源代码移动到适当的子目录,然后从那里开始执行项目,这样您的桌面就不会被大量源文件和可执行文件弄得乱七八糟了ot:about:
printf(“Hello World!”)
这将文本输出到
stdout
I/O输出流,但不会将其传递到终端。(退出程序将刷新
stdout
s
printf(“Hello World!”);
流到终端。建议:
printf(“Hello World!\n”)将使I/O流<代码> StdOut立即被刷新到DeV C++下的一个按钮(我认为是<代码>执行< /代码>按钮)将运行程序OT:建议使用
project
按钮创建一个包含所有项目子目录的唯一目录,将源代码移动到适当的子目录,然后从那里开始处理项目,这样您的桌面就不会被大量源文件和可执行文件弄得乱七八糟