Thread: Multifile Programming

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    5

    Unhappy Multifile Programming

    I am doing a multifile program. There are two files first.cpp and second.cpp that I would like to include in the main file main.cpp. I have first.h and second.h, that I include using
    Code:
    // in file main.cpp
    #include "first.h"
    #include "second.h"
    The .h files look something like this:
    Code:
    // in files first.h and second.h
    #ifndef __FIRST_H
    #define __SECOND_H
    
    int	init(void);
    
    #endif
    And in the files first.cpp and second.cpp, I have added the lines
    Code:
    // in files first.cpp and second.cpp
    #include "first.h"
    #include "second.h"
    I use the Turbo C++ 3.0 compiler. I have set the include directory to the directory that contains the .h and .cpp files. I can compile successfully, but I can't link it. The error message is 'Undefined symbol init() in module main.cpp'. Please help.
    Last edited by z0diac; 11-28-2003 at 10:32 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Name disamb. in multifile project
    By gibbofresco in forum C Programming
    Replies: 2
    Last Post: 11-01-2007, 11:15 AM
  2. Template + Multifile
    By Mehdi in forum C++ Programming
    Replies: 1
    Last Post: 11-02-2006, 07:17 AM
  3. Compiling Multifile Program
    By tdk_ratboy in forum C++ Programming
    Replies: 7
    Last Post: 06-04-2004, 02:36 PM