windows - Cygwin,编译和运行 C 程序时出现 "couldn' t get proc lock 错误

标签 windows makefile cygwin ncurses

问题

我有一些已经使用了半年的 C 语言程序,我希望现在可以继续使用它们。之后我确实安装了 Windows 10(64 位),所以我认为可能是个问题,但从那时起程序就在 Windows 10 上运行。

大约 2 个月前,我可以使用 make 文件构建并运行可执行文件,但是当我今天再次尝试时,在我看来可执行文件似乎没有运行。我现在也尝试更新 cygwin 和(我认为)所有相关的软件包。

我用谷歌搜索了 cygwin 是否有任何重要的变化,但我没有真正找到任何东西。

详情

当我尝试运行任何程序时,在 ./executeables/helloworld.exe 行很长一段时间没有任何反应,然后最终产生错误:

$ make 1
gcc 1-helloworld.c -o ./executeables/helloworld.exe -lncurses
./executeables/helloworld.exe
      0 [sig] make 7332 get_proc_lock: Couldn't acquire sync_proc_subproc for(5, 1), last 7, Win32 error 0
   1324 [sig] make 7332 proc_subproc: couldn't get proc lock. what 5, val 1

在此之后,没有任何反应,我什至无法使用 ctrl+C 停止进程,所以我必须使用任务管理器结束“make.exe”(很奇怪,它由 2 个进程组成)。然后终端只会说

makefile:2: recipe for target '1' failed
make: *** [1] Error 1

所以我猜测从 Windows 获取互斥锁或锁以创建进程时存在问题,但我不知道为什么会发生这种情况。

代码

此 try 中的示例将此代码用于 hello world 程序,但对于更复杂的程序也是如此。

#include <ncurses.h>
#include <string.h>

int main() {
    char *message="Hello World";
    int row,col;
    int len = strlen(message);

    initscr();
    
    getmaxyx(stdscr, row, col);                  //screensize
    mvprintw(row/2, (col-len)/2, "%s", message); //center of screen
    getch();
    
    refresh();
    endwin();
    
    return 0;
}

有没有人见过这个问题?

最佳答案

Avast 杀毒软件阻止程序正常运行。禁用它使一切运行完美。我终于在这个线程中找到了答案:

Netbeans 8.1 IDE compiles and builds C programs but does not show their output

注意: 由于它没有被标记为该线程中问题的答案,并且因为该问题没有明确关注相同的错误(尽管呈现相同的错误),我将保留我的问题而不是将其标记为重复。

感谢 Sheshadri Iyengar 提供解决方案。

关于windows - Cygwin,编译和运行 C 程序时出现 "couldn' t get proc lock 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34765472/

相关文章:

c++ - wstringstream 到 LPCWSTR

C++ 在 Windows 中发送一个简单的信号

java -'javac' 在 Windows 7 中不被识别为内部或外部命令

c++ - 如何在 Windows 上安装 GMP Mp? (C++)

c++ - C++ Makefile依赖性:目标文件依赖哪些文件?

c++ - Cygwin Make bash 命令未找到

c++ - 如何使用 CDT 配置 Eclipse?

windows - 建立cvhaartraining.lib

c++ - 找不到 -lperl 在 C++ 上执行 makefile

hadoop - Java环境位置为 'not a valid identifier'