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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:35:47+00:00 2026-06-15T17:35:47+00:00

I have 3 functions separated in .c files and the main.c I would like

  • 0

I have 3 functions separated in .c files and the main.c I would like to make the make file, I wrote in the file:

# Indicate that the compiler is the gcc compiler

CC=gc

# Indicate to the compiler to include header files in the local folder
CPPFLAGS = -I

main: method1.o
main: method2.o
main: method3.o
main: method4.o
main.o: main.h

Whereas method 1,2,3,4 is the functions of the main .c and I have the following problem when I type make in the shell:

make
gcc  -I  -c -o method1.o method1.c
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: ld returned 1 exit status
make: *** [method1.o] Error 1
  • 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-15T17:35:47+00:00Added an answer on June 15, 2026 at 5:35 pm
    CC=gcc
    CPPFLAGS=-I include
    VPATH=src include
    main: main.o method1.o method2.o method3.o method4.o -lm
        $(CC) $^ -o $@
    main.o: main.c main.h
        $(CC) $(CPPFLAGS) -c $<
    method1.o: method1.c
        $(CC) $(CPPFLAGS) -c $<
    method2.o: method2.c
        $(CC) $(CPPFLAGS) -c $<
    method3.o: method3.c
        $(CC) $(CPPFLAGS) -c $<
    method4.o: method4.c
        $(CC) $(CPPFLAGS) -c $<
    

    it worked like this

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

Sidebar

Related Questions

I have many structs (classes) and standalone functions that I like to compile separately
I currently have a project with 3 files. One DBheader.h header file that includes:
I have a very simple function that takes a list of comma separated (x,y)
I have 2 functions on a seperate page that I am including of the
I have functions that return an object, but I'm confused that should I return
I have functions that contribute to small parts of a figure generation. I'm trying
Here's the use case: I have a .cpp file which has functions implemented in
I have a main application that loads up some plugins. These plugins are loaded
I have a section of data that loads a main view with a stylesheet
I am trying to read from a file that has comma seperated values like

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.