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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:07:55+00:00 2026-05-24T08:07:55+00:00

I have a problem with my Makefiles on Gentoo Linux. Here is my folder

  • 0

I have a problem with my Makefiles on Gentoo Linux.

Here is my folder hierarchy:

Development
 -> GLTools  
   -> include    
   -> src

->Triangle    
  ->triangle.cpp    
  ->Makefile

and my Makefile:

MAIN = triangle
SRCPATH = ./
SHAREDPATH = ../GLTools/src/
SHAREDINCPATH = ../GLTools/include/
LIBDIRS = -L/usr/local/lib
INCDIRS = -I/usr/include -I/usr/local/include -I/usr/include/GL \    
              -I$(SHAREDINCPATH)  -I$(SHAREDINCPATH)GL

CC = g++
CFLAGS = $(COMPILERFLAGS) -g $(INCDIRS)
LIBS = -lglut -lGL -lGLU -lm

prog : $(MAIN)

$(MAIN).o : $(SRCPATH)$(MAIN).cpp
glew.o    : $(SHAREDPATH)glew.c
GLTools.o    : $(SHAREDPATH)GLTools.cpp
GLBatch.o    : $(SHAREDPATH)GLBatch.cpp
GLTriangleBatch.o    : $(SHAREDPATH)GLTriangleBatch.cpp
GLShaderManager.o    : $(SHAREDPATH)GLShaderManager.cpp
math3d.o    : $(SHAREDPATH)math3d.cpp

$(MAIN) : $(MAIN).o glew.o
     $(CC) $(CFLAGS) -o $(SRCPATH)$(MAIN) $(LIBDIRS) $(SRCPATH)$(MAIN).cpp \
         $(SHAREDPATH)glew.c $(SHAREDPATH)GLTools.cpp $(SHAREDPATH)GLBatch.cpp\ 
         $(SHAREDPATH)GLTriangleBatch.cpp $(SHAREDPATH)GLShaderManager.cpp \
         $(SHAREDPATH)math3d.cpp $(LIBS)

clean:
    rm -f *.o

My problem is that get the following error:

demonking@Master ~/Development/Triangle $ make
g++    -c -o triangle.o triangle.cpp
triangle.cpp:4:50: error: GLTools.h: No such file or directory
triangle.cpp:5:56: error: GLShaderManager.h: No such file or directory

But when I copy my Makefile to the folder Development (a folder up one level) and edit my paths it compiles without any errors.

Why do I get an error when my triangle.cpp and Makefile are in one folder and I try to access GLTools in the parent folder?

  • 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-24T08:07:55+00:00Added an answer on May 24, 2026 at 8:07 am

    The default rule for compiling c++ uses CXXFLAGS rather than CFLAGS, and you haven’t set it so it does not include INCDIRS.

    Add

    CXXFLAGS = $(COMPILERFLAGS) -g $(INCDIRS)
    

    and try again.

    The way you would have spotted this yourself is by reading the output of make. Notice the first line in the output you exhibit:

    g++    -c -o triangle.o triangle.cpp
    

    No include flags. No -g. None of the stuff that you took all the trouble to set up.

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

Sidebar

Related Questions

I think I have a problem with my makefile. I'm writing this program: Q2.cpp
Hello I have a problem while trying to run a makefile. I change the
I have a problem with a makefile. I have three classes. They do pretty
I have a problem with the usage of CMake on Linux 64 bit. I
I have a problem because i have never written any makefile. So if any
I have a problem when i try to build my makefile project within Eclipse
I have no problem compiling specific code the following way: g++ -I /opt/local/include Code1.cc
I’m trying to learn makefiles. I have the following Makefile: ctx/%.ctx: rst/%.rst texlua rst_parser.lua
I have problem in some JavaScript that I am writing where the Switch statement
I have problem with return statment >.< I want to store all magazine names

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.