Can't use multiple sources

This is a discussion on Can't use multiple sources within the C Programming forums, part of the General Programming Boards category; I read the FAQ here on cprogramming.com just to make sure I was doing it right and there was no ...

  1. #1
    Mad OnionKnight's Avatar
    Join Date
    Jan 2005
    Location
    Umeň, Sweden
    Posts
    555

    Can't use multiple sources

    I read the FAQ here on cprogramming.com just to make sure I was doing it right and there was no problem in theory.
    However it seems that my compiler (command-line Borland) doesn't compile the external sources. I know this is a C-board and the FAQ entry is in C++ however the same problem arouses when compiled as a C++ app, just different error messages.

    The errors I get are "unresolved external" for each function/variable that is used from the foreign files.

    And I haven't forgotten to put prototypes, structures and the likes in the headers either. From what I understand the compiler includes a header file like src1.h, and then automatically looks for a source that accompanies it like src1.c, but it just won't work. I tried compiling it with MSVC++ too and that didn't work either.

  2. #2
    ... kermit's Avatar
    Join Date
    Jan 2003
    Posts
    1,528
    What are the names of the files you are wanting to compile, and what is the command you are issuing? If you are trying to compile several files together, you need to explicitly name them from the command line (as you have no doubt read at the end of the FAQ you mentioned)

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,490
    > However it seems that my compiler (command-line Borland) doesn't compile the external sources
    Without an IDE or a makefile, you have to tell the compiler all your source files,
    so for example
    bcc32 util.c main.c func.c

    With an IDE or makefile, you would only recompile say util.c when it (or something it depends on, say an include file) is changed. This is what makes compiling large projects efficient, by only recompiling the necessary parts.

  4. #4
    Mad OnionKnight's Avatar
    Join Date
    Jan 2005
    Location
    Umeň, Sweden
    Posts
    555
    Haha no I didn't read that actually. Thought it was just a simple output test to see that it worked.
    I don't like IDEs as they would restrict me to one language and makefiles I wouldn't bother with unless I made something big. But there should be some compiler arguments options in Project Settings in my editor so I'll survive this.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 06-08-2009, 03:03 PM
  2. Downloading from multiple sources
    By ROCKaMIC in forum Windows Programming
    Replies: 0
    Last Post: 05-08-2005, 07:24 PM
  3. Linker errors - Multiple Source files
    By nkhambal in forum C Programming
    Replies: 3
    Last Post: 04-24-2005, 02:41 AM
  4. File resuming, and multiple sources
    By kronixx in forum C Programming
    Replies: 3
    Last Post: 04-13-2005, 04:20 PM
  5. Copying info from multiple sources
    By Prog.Patterson in forum Windows Programming
    Replies: 5
    Last Post: 04-29-2002, 11:42 AM

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