本文介绍了Avi *功能不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在做一个需要处理avi文件的项目.我想用C语言来做.我已经包含了vfw.h头文件,并且存在所需的库,但是avi函数无法正常工作.在编译过程中,未显示任何错误,但我无法运行该程序,该程序突然停止.我尝试调试.我发现,一旦遇到AVIFileInit()函数,就会出现SIGSEGV分段错误.

甚至这段代码也不起作用:

Hi,

I''m doing a project which requires manipulating an avi file. I want to do it in C language. I have included the vfw.h header file and the required libraries are there but the avi functions are not working. During compilation no error is shown but I cant run the program, it halts abruptly. I tried to debug. I found that as soon as AVIFileInit() function is encountered, a SIGSEGV segmentation fault occurs.

Even this code is not working:

#include<windows.h>
#include <vfw.h>
#include <stdio.h>
#include <stdlib.h>

void main()
{
printf("Hello\n");
AVIFileInit();
printf("World\n")
}


编译时没有任何错误,但是当我运行它时,它只会输出Hello,但之后会说" project1.exe遇到问题,需要关闭".当我尝试调试时,发现在AVIFileInit()处发生了SIGSEGV分段错误.任何人都可以帮助我解决这种情况.为什么像AVIFileInit()这样的简单函数在简单程序中不起作用.我要去哪里了?


This compiles without any error but when i run it, it''ll only output Hello but after that it''ll say "project1.exe has encountered a problem and needs to close". When I tried to debug, found that SIGSEGV segmentation fault is occuring at AVIFileInit(). Could anyone please help me resolve this situation. Why is a simple function like AVIFileInit() not working in a simple program. Where am i going wrong?

推荐答案

#include<windows.h>
#include <vfw.h>
#include <stdio.h>
#include <stdlib.h>

#pragma comment(lib,"Vfw32")

void main()
{
    printf("Hello\n");
    AVIFileInit();
    printf("World\n");
    AVIFileExit();
}



更新
如果您使用的是MinGW,请使用 dlltool [ ^ ],记下有关STDCALL的详细信息,以从dll生成一个新的导入库.

问候
Espen Harlinn



Update
If you are using MinGW, use dlltool[^] ,note the details about STDCALL, to generate a new import library from the dll.

Regards
Espen Harlinn




这篇关于Avi *功能不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-31 04:58