Thread: AVIFile linker error

  1. #1
    Registered User
    Join Date
    Jun 2005
    Posts
    5

    AVIFile linker error

    Hello,
    I was wondering if anybody could help me out with an error I always get:
    Trying to build the simple project below I always get "[Linker error] undefined reference to `AVIFileInit@0'"
    I am Using Dev-C++ and added the libraries vfw32.lib and winmm.lib.

    Code:
    #include <windows.h>
    #include <iostream>
    #include "vfw.h"
    
    int main(int argc, char *argv[]){
      AVIFileInit();
      system("PAUSE");
      return EXIT_SUCCESS;
    }
    I would really appreciate if someone could give me a short hint,
    best regards,
    slapy

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    >>added the libraries vfw32.lib and winmm.lib<<

    How exactly did you do this and what library names did you use?
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  3. #3
    Registered User
    Join Date
    Jun 2005
    Posts
    5
    I opened project->project options->parameters->"Add libraries or Object" then I looked for the right name from my "Microsoft Platform SDK SP1 2003" in folder "Lib"

    did I forget anything? is that wrong?

  4. #4
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Instead of adding the ms libs, you should add the the ones that come with your compiler. Just type '-lvfw32' in the 'linker' field (you can use the 'add libraries or objects' option, too, but look for libvfw32.a in the lib directory of your dev-cpp/mingw installation directory). For that example you don't need libwinmm.a (winmm.lib).
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  5. #5
    Registered User
    Join Date
    Jun 2005
    Posts
    5
    thank you, that is actually working but how do you now that it is -lvfw32.lib instead of -vfw32.lib?
    thanks, again!
    slapy

  6. #6
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    I read the manual. Here's one example: http://www.cs.utah.edu/dept/old/texi...c_5.html#SEC19

    Running ld --help from a command prompt is also handy(ld is the linker). You can do the same with the other tools in the 'bin' directory of your dev-cpp/mingw installation; piping the output to a text file gives you a handy lookup for various switches and arguments, eg ld --help >ld.txt.

    Lots of manuals in chm format here, too:

    http://htmlhelp.berlios.de/books/chm.php
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  7. #7
    Registered User
    Join Date
    Jun 2005
    Posts
    5
    that is, again, very helpful, thank you!
    slapy

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Errors including <windows.h>
    By jw232 in forum Windows Programming
    Replies: 4
    Last Post: 07-29-2008, 01:29 PM
  2. Crazy errors caused by class, never seen before..
    By Shamino in forum C++ Programming
    Replies: 2
    Last Post: 06-10-2007, 11:54 AM
  3. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 10:03 AM
  4. pointer to array of objects of struct
    By undisputed007 in forum C++ Programming
    Replies: 12
    Last Post: 03-02-2004, 04:49 AM
  5. Linking error
    By DockyD in forum C++ Programming
    Replies: 10
    Last Post: 01-20-2003, 05:27 AM