modular programming

This is a discussion on modular programming within the C Programming forums, part of the General Programming Boards category; hello i'm writing this code to teach myself programming with modules, but obviously theres something wrong since my compiler says ...

  1. #1
    Registered User
    Join Date
    Jun 2006
    Posts
    45

    modular programming

    hello i'm writing this code to teach myself programming with modules, but obviously theres something wrong since my compiler says

    Compiling BPS.C:
    Linking bps.exe:
    Linker Warning: No module definition file specified: using defaults
    Linker Error: Undefined symbol _output in module BPS.C
    Linker Error: Undefined symbol _input in module BPS.C

    Code:
    //inout.c
    #include<stdio.h>
    #include"inout.h"
    
    static void stars (void);		//prints out a line of *, local function prototype defined here
    
    
    int input(void){                                     //prototype in header		
    
        char c;
        int res,keuze;
    
        stars ();
        printf("   1. BPM 2 FPS\n   2. FPS 2 BPM\n\nkeuze: ");
        stars ();
    
        while((res=scanf("%d%c",&keuze,&c))!=2 || c!='\n' || keuze<1 || keuze>2){
            scanf("%*[^\n]%*c");
            printf("tik 1 of 2");
    	}
    
    return keuze;
    }
    
    void output(int keuze){
        printf("uw keuze is %d",keuze);
    }
    
    static void stars(void){
    
        int i;
    
        for(i=0; i<30; i++){
            putchar('*');
        }
    
    }
    Code:
    //inout.h
    
    int input(void);
    void output(int keuze);
    Code:
    //bps.c
    #include<stdio.h>
    #include"inout.h"
    
    int main (void){
    
    	int keuze;
    
    	keuze=input();
    	output(keuze);
    
    
    
    return 0;
    }
    all files are stored in same directory, so why isnt this working?
    Last edited by breaka; 08-18-2006 at 06:25 AM.

  2. #2
    Register User andor's Avatar
    Join Date
    Aug 2006
    Location
    Novi Sad
    Posts
    42
    gcc compiled it. You are compiling bps.c or bpm.c? I compiled like this:
    gcc -c inout.c
    gcc -c bpm.c
    gcc -s inout.o bpm.o -o bpm
    Last edited by andor; 08-18-2006 at 05:39 AM.

  3. #3
    Registered User
    Join Date
    Jun 2006
    Posts
    45
    i just ran bps.c from borland 4.52, do i have to compile every file or... dont now much about it

  4. #4
    Register User andor's Avatar
    Join Date
    Aug 2006
    Location
    Novi Sad
    Posts
    42
    Quote Originally Posted by breaka
    Compiling BPS.C:
    Linking bps.exe:
    Linker Warning: No module definition file specified: using defaults
    Linker Error: Undefined symbol _output in module BPS.C
    Linker Error: Undefined symbol _input in module BPS.C
    You can see here that for some reason inout.c is not compilinging becouse it should write
    Compiling inout.c:
    Compiling BPS.C:
    Linking bps.exe:
    So you probably need to ad to project the inout.c module. Sorry but I never used borland copiler
    Quote Originally Posted by breaka
    do i have to compile every file
    No. If U use borland compiler he should do it for you if project created the right way

  5. #5
    Registered User
    Join Date
    Jun 2006
    Posts
    45
    made independent files instead of creating a project, making it a project now, thanx

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Modular Programming
    By St0rM-MaN in forum C Programming
    Replies: 7
    Last Post: 05-10-2007, 02:56 AM
  2. Modular
    By loopshot in forum Game Programming
    Replies: 7
    Last Post: 01-20-2006, 06:24 PM
  3. Modular math
    By PJYelton in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 10-01-2003, 08:35 AM
  4. Modular Division problem
    By Malek in forum C++ Programming
    Replies: 7
    Last Post: 05-24-2003, 06:08 PM
  5. Completely modular motherboards?
    By SMurf in forum A Brief History of Cprogramming.com
    Replies: 10
    Last Post: 02-23-2003, 11:56 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21