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

  • SEARCH
  • Home
  • 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 6344327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:36:54+00:00 2026-05-24T20:36:54+00:00

/me/home/file1.c containes function definition: int mine(int i) { /* some stupidity by me */

  • 0
/me/home/file1.c containes function definition:

int mine(int i)
{
    /* some stupidity by me */
}

I’ve declared this function in

/me/home/file1.h

int mine(int);

if I want to use this function mine() in /me/home/at/file2.c

To do so, all I need to do is:

file2.c

#include "../file1.h"

Is that enough? Probably not.

After doing this much, when I compile file2.c, I get undefined reference to 'mine'

  • 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-05-24T20:36:55+00:00Added an answer on May 24, 2026 at 8:36 pm

    You will also need to link the object file from file1. Example:

    gcc -c file2.c
    gcc -c ../file1.c
    gcc -o program file2.o file1.o
    

    Or you can also feed all files simultaneously and let GCC do the work (not suggested beyond a handful of files);

    gcc -o program file1.c file2.c
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Directory is something like: home/ file1.html file2.html Another_Dir/ file8.html Sub_Dir/ file19.html I am using
I've got a really simple question. I want to redirect all requests to http://localhost/home/
The only way I know is: find /home -xdev -samefile file1 But it's really
Say the path of the file 'file1.txt' is /home/bentley4/Desktop/sc/file1.txt Say my current working directory
If I write the config like this: location: /a { root /home/files/b/ } and
File: /home/USER/DIR/a http://www.here.is.a.hyper.link.net/ /home/USER/DIR/b http://www.here.is.another.hyper.link.net/ Need to remove all the odd lines in this
I have a python project with this directory structure and these files: /home/project_root |---__init__.py
ok i got this problem. i have this routes: (code bit change) File:/home/dotcloud/current/config/routes.js exports.routes
I have this jquery for my menu buttons, what I want is to get
I use a cluster of about 30 machines that have all recently been reconfigured

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.