Please i got a problem linking my .cpp files together in my c++ project. I dnt knw how to specify the file path for #include . Please any help?

Please could you include an example to your problem? It's kind of hard to find out where you are going wrong, but, here is an example (of what I assume you are trying to do):

// Test.h 

class Test {


      Test(); // constructor 

      void doSomethingCreative();


And then your implementation of this class:

#include "Test.h" // assuming the header file is called "Test.h"

   // constructor implementation

void Test::doSomethingCreative()
    // Method implemenation

At compile time, we just need to compile the .cpp file over the .h So, therefore your main will look something like so:

#include <iostream>
#include "Test.h"

int main(int argc, char *argv[]) {

   Test t;


To compile, again, using GCC would be something like:

g++ Test.cpp main.cpp -o main

Hope this helps slightly.

U are awesome man! Thanks, u've done it all. +u solved a little problem i had with oop c++

This question has already been answered. Start a new discussion instead.