Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8616005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:31:03+00:00 2026-06-12T05:31:03+00:00

I have two C files (first file need another one). I should use #include

  • 0

I have two C files (first file need another one).

I should use #include "XXX.C", but how I can make separately .obj files and then connect it (something like Borland’s Project)? I read something about link a, b command but it doesn’t work and I can’t find any reference.

Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T05:31:04+00:00Added an answer on June 12, 2026 at 5:31 am

    You should not use #include “XXX.C”. If you want to compile it separately.
    You have to write a “XXX.h” with all functions you want to call.

    After that, you can compile the files separately:

    gcc -c YYY.c -o yyy.o
    gcc -c XXX.c -o xxx.o
    

    If you want to compile and link in a single pass:

    gcc xxx.c yyy.c -o xxx
    

    or if you want to compile xxx.c and use the object file previous generated:

    gcc xxc.c yyy.o -o xxx
    

    or even:

    gcc xxx.o yyy.o -o xxx
    

    In the last example, gcc would call the linker, as there is no source code to compile.

    But if you have more than two or three files, the next thing to check is how to use a Makefile.

    Example:

    xxx.c:

    #include "yyy.h"
    
    int x(int a)
    {
       return a + 1;
    }
    
    int main(int argc, char **argv)
    {
       x(1);
       y(2);
       return 0;
    }
    

    yyy.c:

    int y(int b)
    { 
       return b + 2;
    }
    

    yyy.h:

    #pragma once
    int y(int b);
    

    Can be compiled separatelly:

    gcc -c yyy.c -o yyy.o
    gcc xxx.c yyy.o -o xxx
    

    In this example, xxx.c calls a function defined on yyy.c.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hi guys i have two pipe delimited files,first file contains 1000 records and second
Suppose I have two XML files. First XML File: <?xml version=1.0?> <AccessRequest xml:lang=en-US> <AccessLicenseNumber>Your_License</AccessLicenseNumber>
I have the two following text files: First one: chr10 1000 1001 DEL 2.4807
I am have two xml files.. I first get one and loop through it
I have two CSV files which use @ to divide each column. The first
I have two excel files. First excel file contains the Person Name and Total
I have two csv file. First File has date offerid clicks orders Second File
In my dbsql file, I have two CREATE TABLES the first works and the
I have a web application and two class files, First class is MyClass.class which
I have two files client.php and server.php. The client file send a HTTP request

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.