Entropy
Entropy

Reputation: 295

Segmentation fault in AVIFileInit()

I’m currently using Code::Blocks with the GCC Compiler on XP. The call to AVIFileInit() in the following test code causes a segmentation fault:

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

int main() {
   printf("%s", "AVI Init...\n\n");

   AVIFileInit(); /// <-- Crashes here!!!

   printf("%s", "AVI Exit...\n\n");

   AVIFileExit();

   printf("%s", "return...\n\n");

   return 0;
}

I can’t find any cause or solution for this problem. Any help would be much appreciated.

Upvotes: 0

Views: 98

Answers (1)

Entropy
Entropy

Reputation: 295

Well I’ve finally solved this problem, so for anyone else having a similar issue, I thought I’d post my answer:

Omit the “.lib” from the filename in the linker settings. (In this case, write “VFW32”, not “VFW32.LIB”.)

That way, it won’t complain that it can’t find the file, so you won’t have to waste a lot of time looking for it in your installation folder before giving up and eventually linking with another version of the library which didn’t come with this compiler and isn’t actually compatible.

Upvotes: 0

Related Questions