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 1077229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:32:42+00:00 2026-05-16T21:32:42+00:00

Trying to call a function from another file in C with the following code:

  • 0

Trying to call a function from another file in C with the following code:

main.c

#include "display.h"
int main()
{
display_options();
display_price();

return 0;
}

display.h

int display_options(void);
int display_price(void);

display.c

#include <stdio.h>

int display_options()
{
printf("Welcome to the pizza parlor\n");
printf("What size pizza would you like? (in inches)");

return 0;
}

int display_price()
{
printf("Your pizza will cost 0.00\n");

return 0;
}

I created this following an example here http://www.faqs.org/docs/learnc/x307.html but it doesn’t seem to be working i get an error message in codeblocks 10.05 on the function called in main.c saying “undefined reference to ‘display_options'”

  • 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-16T21:32:43+00:00Added an answer on May 16, 2026 at 9:32 pm

    In Code::Blocks, you need to make sure that display.c is in your project (if you haven’t created a project, do so now) and that it’s also included in one or more build targets. debug and release build targets are created by default, but nothing is added to a target unless you say so. When you create a new file or add an existing file to a project, the IDE should ask you which targets to add the file to. Select all of them and hit OK.

    If your file is already in the project but not included in any target, go to Project | Properties | Build targets and make sure that the Build target files panel shows checkmarks beside both main.c and display.c.

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

Sidebar

Related Questions

I am trying to return (execute) a function from another file in an if
As the title suggested, I'm trying to call the $(document).ready(function() {...}); from another file.
I am trying to call another function, foo(), in the Raw class from main.cpp
I'm trying to call a function in a file from another file. I have
I am trying to basically call a function from another javascript file (inside a
I am trying to call a function in another .php file from this one
I'm trying to call a function from inside the call of another function. If
I'm trying to call a function present in one class from another class by
I am trying to call c# function from javascript the code i have tried
I'm trying to call a function from a form within the same .php file,

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.