如何解决在Windows 8.1崩溃C 2(How to fix crashing C in Win

2019-10-22 08:46发布

我使用的代码块使用MinGW的gcc。 编译构建工作正常,但当我执行它运行它崩溃了:

main.c中:

#include <stdio.h>
#include <stdlib.h>
#include <vlc/vlc.h>
#include <vlc/libvlc.h>
#include <windows.h>

int main(int argc, char **argv) {
    libvlc_instance_t *vlc;
    vlc = libvlc_new (0, NULL);
    return 0;
}

生成日志:

-------------- Clean: Debug in rtsp (compiler: GNU GCC Compiler)---------------

Cleaned "rtsp - Debug"

-------------- Build: Debug in rtsp (compiler: GNU GCC Compiler)---------------

mingw32-gcc.exe -Wall -g -I"C:\Program Files (x86)\VideoLAN\VLC\sdk\include" -c C:\Users\sunuser\Desktop\c\rtsp\main.c -o obj\Debug\main.o
C:\Users\sunuser\Desktop\c\rtsp\main.c: In function 'main':
C:\Users\sunuser\Desktop\c\rtsp\main.c:8:24: warning: variable 'vlc' set but not used [-Wunused-but-set-variable]
mingw32-g++.exe -L"C:\Program Files (x86)\VideoLAN\VLC\sdk\lib" -o bin\Debug\rtsp.exe obj\Debug\main.o  -I"C:\Program Files (x86)\VideoLAN\VLC\sdk\include"  "C:\Program Files (x86)\VideoLAN\VLC\sdk\lib\vlc.lib" "C:\Program Files (x86)\VideoLAN\VLC\sdk\lib\vlccore.lib" "C:\Program Files (x86)\VideoLAN\VLC\sdk\lib\libvlc.lib"
Output file is bin\Debug\rtsp.exe with size 29.64 KB
Process terminated with status 0 (0 minute(s), 1 second(s))
0 error(s), 1 warning(s) (0 minute(s), 1 second(s))

这究竟是为什么?

我怎样才能解决这个问题?

文章来源: How to fix crashing C in Windows 8.1?