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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:22:51+00:00 2026-06-01T10:22:51+00:00

I have main.cpp (including main function) and func1.cpp, and I want to link these

  • 0

I have main.cpp (including main function) and func1.cpp, and I want to link these files with a makefile. Classic form would be:

main: main.o func1.o
    g++ main.o func1.o -o main
main.o: main.cpp
    g++ -c main.cpp
func1.o: func1.cpp
    g++ -c func1.cpp

or one can write

main: func1.o main.o 
    g++ main.o func1.o -o main
func1.o: func1.cpp
    g++ -c func1.cpp
main.o: main.cpp
    g++ -c main.cpp

or

main: main.o func1.o
    g++ main.o func1.o -o main
func1.o: func1.cpp
    g++ -c func1.cpp
main.o: main.cpp
    g++ -c main.cpp

Do the last two differ from the classic one ? Does one have some advantages over the other?

  • 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-01T10:22:52+00:00Added an answer on June 1, 2026 at 10:22 am

    No, the only time the order of the rules comes into play is when you just enter make, in which case it can choose the first rule as the default.

    Beyond that, make is intelligent enough to execute dependent rules no matter where they are in the file.

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

Sidebar

Related Questions

I'm trying to solve an issue with makefile. I have a main.cpp and then
I have 4 files: shared.h main.cpp something.h something.cpp shared.h: #ifndef SHARED_H #define SHARED_H int*
I have three files, a main .cpp file: #include <stdio.h> #include myClass.h int main()
I have the file main.cpp open in my editor. I want to see the
Can't understand what is a problem here: I have got main.cpp file where I
I have a code like this below in /root_project/main.cpp : #include theoraplayer/TheoraVideoClip.h unsigned int
I have main categories and sub categories. I want to be able to sort
i have main activity in which i have Four menus. and i have one
I have this main function: #ifndef MAIN_CPP #define MAIN_CPP #include dsets.h using namespace std;
I'm trying to make a little program with Qt. I have a main.cpp with

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.