Avi *功能不起作用 [英] Avi* functions not functioning

查看:107
本文介绍了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?

推荐答案

这就像一个符咒:
This works like a charm:
#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


我刚刚将您的代码(更正后的内容)复制到了一个简单的控制台应用程序中,它可以正确编译,链接和运行.您确定Avifil32.dll存在于您系统上的正确文件夹中吗?
I have just copied your code (corrected) into a simple console app and it compiles, links and runs without error. Are you sure that the Avifil32.dll is present in the correct folder on your system?


我得到了像Richard所说的Visual Studio,它的工作正常.一个很好的建议是包含Espen Harlinn的#pragma注释,它可以省去属性,并包括其他依赖项和所有过程.谢谢你们. :)
I got Visual studio like Richard said and its working fine. A good suggestion it was to include the #pragma comment by Espen Harlinn, it saves going to the properties and including additional dependancies and all that procedure. Thank you all. :)


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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆