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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:20:38+00:00 2026-06-10T06:20:38+00:00

I was following a tutorial for creating a simple pong game and wanted to

  • 0

I was following a tutorial for creating a simple pong game and wanted to try using makefiles. I did some research and wrote one, but i can’t get it to work.
This is how my project folder looks like.

project/
|__include/
|  |__*.h
|__release/
|  |__obj/
|  |__Makefile
|__src/
   |__*.cpp

This is my Makefile:

CXX         :=  g++

# Directories
SDIR        :=  ../src
IDIR        :=  ../include
ODIR        :=  ./obj
VPATH       :=  $(SDIR)

# Files
_SRCS       :=  stdafx.cpp Pang.cpp Game.cpp MainMenu.cpp SplashScreen.cpp
SRCS        :=  $(patsubst %,$(SDIR)/%,$(_SRCS))
_DEPS       :=  stdafx.h Game.h MainMenu.h SplashScreen.h
DEPS        :=  $(patsubst %,$(IDIR)/%,$(_DEPS))
_OBJS       :=  $(_SRCS:.cpp=.o)
OBJS        :=  $(patsubst %,$(ODIR)/%,$(_OBJS))
EXES        :=  Pang

# Parameters
CXXFLAGS    :=  -O2 -g -Wall -fmessage-length=0
LIBS        :=  -lsfml-audio -lsfml-graphics -lsfml-window -lsfml-system

# Default rule
all: $(SRCS) $(EXES)

# Generic compilation rule
$(ODIR)%.o : %.cpp
    $(CXX) $(CXXFLAGS) -c $< -o $@

# Link object files
$(EXES): $(OBJS)
    $(CXX) $(CXXFLAGS) -o $@ $^ $(LIBS)

# Clean Rule
clean:
    rm -f $(ODIR)/*.o $(EXES)

When i run make, this is what i get:

make all 
make: *** No rule to make target `obj/stdafx.o', needed by `Pang'.  Stop.

The SFML seemed to be working before, so i don’t think it is the problem.
Any help would be great!

  • 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-10T06:20:39+00:00Added an answer on June 10, 2026 at 6:20 am

    this:

    $(ODIR)%.o : %.cpp
    

    should be:

    $(ODIR)/%.o : %.cpp
    

    (note the slash)

    The first one is a rule which expects files like ./objstdafx.o to be created. The second one expects files like ./obj/stdafx.o. So with the first one, make does not know how to build obj/stdafx.o.

    See the documentation for more information about pattern matching rules.

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

Sidebar

Related Questions

I am creating simple reports module by following this tutorial .When i try to
Am following the tutorial here on creating a simple todo list app: http://www.mydroid.apnafundaz.com/2010/07/todolist-application-in-android-step-by-step-guide-with-screen-shots/ Have
I'm following the Official tutorial for creating a administration area. I did the first
I've been following a tutorial on http://michaelellerbeck.com/2009/01/12/creating-a-service-for-visual-basic-2008-express/ for creating a service using VB Express
I'm creating a simple black jack game using the Easy 68K simulator and need
I been following this tutorial on creating a simple API with Node.js and MongoDB,
I'm creating an Internet Explorer plugin using C#. I've been following a tutorial where
I am following a tutorial for creating a simple application in Android , and
I'm following this tutorial http://codemagento.com/2011/03/creating-custom-magento-reports/ creating the simple report module. I have all the
i am creating a multi player iPhone game using the multi player tutorial as

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.