How to include headers by their path in the file system

Hi,
I'm new in this Forum and hope I've chosen the right topic.

I've recently started programming in C++, because I have to use some program-packages from channelflow.org, that are written in that language.
I was able to install the editor Eclipse (which I've used for other languages before) on Linux. I have to admit, that OS is also new to me.
I have installed all the packages I need from the mentioned website, and I am able to compile C++ programs.
That is how far I got. In the next step I was going to test if the packages are all installed properly. That is why I was going to write a simple program, which uses any of the functions of the packages.

I was going to use an example program, that came along with all the packages. Here is the beginning of it:

1
2
3
4
5
6
7
8
9
10
11
12
13
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include "channelflow/flowfield.h"
#include "channelflow/periodicfunc.h"
#include "channelflow/dns.h"
#include "channelflow/utilfuncs.h"

using namespace std;
using namespace channelflow;

int main()


I was going just to include one of the headers, for example dns.h
I tried to do that by writing it's path fully:
#include "/home/damien/channelflow-1.4.2/channelflow/dns.h"
After trying to compile that, Eclipse says:
"The program file specified in the launch configuration does not exist
/home/damien/workspace_damien/Test2/Debug/Test2 not found2"
I know it's possible to include new paths to the search directories, but I dont't see, why my solution does not work, I have found examples in which headers are found just that way.
I also tried it by copying all files with the name dns and all different endings into the directory, where my program is and then just to use
#include "dns.h"
but that doesn't work either.

Am I doing it all wrong, or is there perhaps a simple failure in my syntax?
I would appreciate, if anyone could help me, I've been searching for an answer in the web and some tutorials for quite a while now.

Thanks,
Baerfolg
closed account (Dy7SLyTq)
c++ uses relative paths not absolute ones. ie if you have your project directory as


source
     main.cpp
     headers
          channelflow
               other headers

then it would just be included as #include "headers/channelflow/dns.h"

if you want to make it so that you only have to write the header. ie "dns.h" or "flowfield.h" then when compiling you would do $g++ [source files] -o [elf file] -I/path/to/channelflow/
Topic archived. No new replies allowed.