Page 1 of 1

How to include headers from another project?

Posted: Tue Dec 10, 2013 2:42 pm
by nerdux
Hello Codeliters! please be patient, I'm a newbie here.

I have coded a basic singly linked list class for testing, and compiled it as a dynamic library using codelite. Folder/file structure is as follows:

Work/SingleIntList:
Debug SingleIntList.project singly_int_list.cpp
SingleIntList.mk SingleIntList.txt singly_int_list.h

Work/SingleIntList/Debug:
SingleIntList.so singly_int_list.o singly_int_list.o.d



I have also created a workspace and a project inside it

Work/TestSIL:
Makefile TestSIL TestSIL.workspace

Work/TestSIL/TestSIL:
Debug main.cpp TestSIL.mk TestSIL.project

Work/TestSIL/TestSIL/Debug:
main.o.d


In this workspace (TestSIL) I have "added an existing project" and then selected SingleIntList. So far so good, I have both projects in the TestSIL workspace, but when I compile it terminates with the following error:
/home/mario/Work/TestSIL/TestSIL/main.cpp:2:43: fatal error: SingleIntList/singly_int_list.h: No such file or directory

This is the source for main.cpp in the TestSIL project (so you can see how I'm including the header from the other project):

Code: Select all

#include <iostream>
#include <SingleIntList/singly_int_list.h>

using namespace std;

int main()
{
     SinglyIntList j;

     j.prepend(5);
     cout << "Hola, Mundo" << endl;

     return 0;
}
How should I set things up in order to build this project successfully in this layout?

Re: How to include headers from another project?

Posted: Tue Dec 10, 2013 4:48 pm
by Jarod42
Simply fix the project settings:
Add correct path in Include Paths (Settings... -> Common settings ; Compiler)

linker options may also be fixed.

Re: How to include headers from another project?

Posted: Wed Dec 11, 2013 12:00 am
by nerdux
Thank you very much, Jarod42, that fixed it. And you were right, linker options must be fixed too (workig on that right now).

Re: How to include headers from another project?

Posted: Wed Jan 08, 2014 8:03 pm
by Zoran
nerdux wrote:Thank you very much, Jarod42, that fixed it. And you were right, linker options must be fixed too (workig on that right now).
Hello,
How should these linker options be fixed?
I have the same problem and after I added the path in "Include Paths" my project still does not compile.

Re: How to include headers from another project?

Posted: Wed Jan 08, 2014 8:22 pm
by eranif
Zoran wrote:I have the same problem and after I added the path in "Include Paths" my project still does not compile
This is a very generic description that gives no information about your problem

Please read the HOW TO POST thread and provide all the information needed

Eran

Re: How to include headers from another project?

Posted: Fri Jan 10, 2014 5:47 pm
by Zoran
eranif wrote:
Zoran wrote:I have the same problem and after I added the path in "Include Paths" my project still does not compile
This is a very generic description that gives no information about your problem

Please read the HOW TO POST thread and provide all the information needed

Eran
Sorry, my question is specifically about the nerdux's sentence which I had quoted in my previous post — "linker options must be fixed too".
Perhaps I didn't understand well, but I thought that this means that two steps are required:
1. adding the path to "Include paths", which is explained in this topic.
2. fixing linker options, which I don't know how to do

Thanks, Zoran

Re: How to include headers from another project?

Posted: Fri Jan 10, 2014 5:51 pm
by eranif
Zoran wrote:fixing linker options
Project Settings -> Common Settings -> Linker

Edit the library paths and libraries to link against

Eran