Thread: problem with multiple files

  1. #1
    Unregistered
    Guest

    Question problem with multiple files

    i have 3 files (will be more when i finnish)

    the hedder file that has the #include<stdio.h> etc, the prottyping for all the functions, and structures

    then i have the c file with the main in it, which calls a function in the other file, has a include statment to the hedder.

    and the other file whihc has a include to the hedder, and the definition of the functions.

    however when i compile/link it i get the errors

    Linking...
    main.obj : error LNK2001: unresolved external symbol _DisplyAllVideos
    main.obj : error LNK2001: unresolved external symbol _AddNewVideo
    Debug/vslib.exe : fatal error LNK1120: 2 unresolved externals
    Error executing link.exe.

    any ideas??

  2. #2
    Registered User C_Coder's Avatar
    Join Date
    Oct 2001
    Posts
    522
    main.obj : error LNK2001: unresolved external symbol _DisplyAllVideos
    main.obj : error LNK2001: unresolved external symbol _AddNewVideo
    These errors mean the compiler doesnt recognize those functions, doesnt even know that they are functions.

    Check you have included the functions header in both .c files.

    myfuncs.h : contains your function prototypes.
    It dosent need to include any other files.

    myfuncs.c : contains your coded functions, this needs to include "myfuncs.h" and any other header needed for standard functions.

    main.c : Contains your main function. This needs to include "myfuncs.h" and any other header needed for standard functions, you don't need to include myfuncs.c in main.c.

    If this is how you have done it, then I don't know.
    All spelling mistakes, syntatical errors and stupid comments are intentional.

  3. #3
    Registered User
    Join Date
    Oct 2001
    Posts
    197
    Have you installed your compiler correctly??

    If you won´t post any sourcecode or give us some details about your system, you will never get any answer.

    klausi
    When I close my eyes nobody can see me...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to create a C project with multiple source files
    By MSF1981 in forum C Programming
    Replies: 5
    Last Post: 03-22-2009, 09:25 AM
  2. OPENFILENAME and multiple files.
    By -leech- in forum Windows Programming
    Replies: 4
    Last Post: 02-25-2003, 01:40 PM
  3. globals & multiple .c files
    By Unregistered in forum C Programming
    Replies: 8
    Last Post: 10-30-2002, 09:43 PM
  4. Multiple Resource files
    By doodlak in forum C++ Programming
    Replies: 0
    Last Post: 07-04-2002, 06:13 PM
  5. using a class in multiple source files???
    By Crossbow in forum C++ Programming
    Replies: 9
    Last Post: 06-18-2002, 07:42 PM