G++ Project Root

BEFORE I CONTINUE: I know that this information is probably up somewhere, but I am having trouble finding it and am getting REALLY frustrated.

So, here is the breakdown of my project:

  • root
    • arithmetic.cpp
    • Tokens
      • tokenizer.h
      • token_types.h
      • tokens.h
    • Interpreter
      • interpreter.h

I need a command to set the root of the project at root so that interpreter.h can use the path “Tokens/tokens.h”. If you didn’t read the title, I’m using g++, and I am on Windows. Any help would be appreciated, and it would be really awesome if you could tell me where to find this information online. Thanks!

How are you building this project? This sort of logic really goes in your makefile.

Uh, I am fairly new to C++. What is a makefile?

As for how I’m building this, I could be misinterpreting the question, but my plan is to use the tokenizer to and arithmetic.cpp to build a syntax directed interpreter.

Tldr: thanks for the reply, but could u elaborate on the makefile?

In order to use a C/C++ program, you need to compile that code. How are you compiling the code?

Um, I am using g++ & simply using “g++ PATH-TO-CPP-FILE”

Info from “g++ --version” (besides copyright info)
g++ (Rev3, Built by MSYS2 project) 12.1.0

Was this useful, or am I completely missing the question’s meaning?

So, directly invoking g++ just doesn’t work very well for large projects. A makefile or cmake file helps link together all of the pieces.

Either in the command line or the makefile you need to tell the compiler what the include directory is.

I’d look over something like this:

Um, hi! Sorry about the ridiculously late response, but I have been looking around the Internet to address my current problem: I CAN’T RUN THE MAKEFILE. The command “make” doesn’t work. The command “mingw-get install mingw32-make”, as instructed by a tutorial, to install the tools needed, ALSO doesn’t work. Any guidance here?

Oh, and thank you for being so helpful!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.