Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

>hrl files present in the include directory of project are not recognized in the src directory of the project #298

Open
blacklightknight opened this issue Mar 1, 2017 · 20 comments

Comments

@blacklightknight
Copy link

I was studying the source code of ejabberd on eclipse. i figured out that each of my .erl files present the src folder of the project with a include statement in it was showing an compilation error on saving the project.
When I searched for the errors it said that it was not able to include the .hrl files present in the include folder.
I wanted to know that why is this happening as the files placed in include directory must be recognized in the src folder of the same project.
i have also tried the solutions given on this link
http://www2.erlangcentral.org/wiki/?title=Compile_With_Hard_To_Find_Include_Files_In_Erlang_Shell
but this also didn't worked for me.
Anyone who has any Idea about the issue.

@vladdu
Copy link
Collaborator

vladdu commented Mar 1, 2017

I imported the project, without building/compiling anything (can't on this machine). The only include files that couldn't be found are:

  • XmppAddr.hrl
  • xmpp.hrl
  • fxml.hrl
  • jid.hrl
  • ns.hrl

which don't exist and I assume are being generated by the build (for example the first one from asn1).

If you look for those files and see what directories they are located in, then you can change the eclipse project's configuration (right-click->properties->Erlang) and add those directories to 'include'. Then it should work.

Please note that parse transforms aren't handled and the errors related to that will remain.

@vladdu
Copy link
Collaborator

vladdu commented Mar 1, 2017

Maybe I should have asked first: how did you create the ejabberd project in eclipse? Is it configured properly (src and include directories)?

@blacklightknight
Copy link
Author

blacklightknight commented Mar 2, 2017 via email

@vladdu
Copy link
Collaborator

vladdu commented Mar 2, 2017

If your Eclipse project is properly configured as an Erlang project, then the 'include' directory is recognized. Do your project's properties look like below? All source directories and all include directories should be listed, if there are more than one.

untitled

@blacklightknight
Copy link
Author

blacklightknight commented Mar 2, 2017

scr
scr2
yes Vlad my Eclipse project is properly configured as an Erlang project.
But still I was facing that problem initially of not being able to recognize .hrl files but when I copied the .hrl files in the src folder I was able to access them inside my .erl files also

@vladdu
Copy link
Collaborator

vladdu commented Mar 2, 2017

It should have found the hrl files in include too. Is this your own project, or ejabberd?

@blacklightknight
Copy link
Author

I first create an erlang project then I import the source code of ejabberd into it.

@vladdu
Copy link
Collaborator

vladdu commented Mar 2, 2017

Try this: Build first ejabberd from the command line. Then create a new project in Eclipse and in the "location" field enter the location of the ejabberd code. Then on the "project layout" page, press "discover paths". All directories including .erl or .hrl files will be added automatically.

This should give you better configuration that hopefully finds all files.

@blacklightknight
Copy link
Author

Actually, I am using windows platform so I had already built ejabberd using the windows installer.I didn't get the meaning of "location","project layout", and "discover paths" you mentioned.

@vladdu
Copy link
Collaborator

vladdu commented Mar 2, 2017

When creating a project, you get to set the name and there is a field for specifying the location. Uncheck the "use default" and browse to wherever the ejabberd code is.

Then on the third page (the second image you attached) you have the project layout configuration. Since there is already code, the button "Discover paths..." should be enabled, press it to fill the paths automatically.

@blacklightknight
Copy link
Author

Yes I did this but still .hrl files are not recognized from src folder.you can see:
scr3

@vladdu
Copy link
Collaborator

vladdu commented Mar 4, 2017

Oh, I see. This is not how erlide works. You don't need to compile from the console, but erlide is doing it for you. If you set Project->Build automatically enabled, you only have to check the Problems view for any warnings or errors. When you save a change, that file will be recompiled automatically.

@blacklightknight
Copy link
Author

yes I knew that way too, but the problem still continues this way as yo can see in the following screenshots:
a
b

@vladdu
Copy link
Collaborator

vladdu commented Mar 6, 2017

Do I see right that the Erlang file has no syntax highlighting? Then it's possible that there's something wrong with the communication with the backend.

Anyway, did you build ejabberd before importing the project? The jid.hrl file, for example, is part of xmpp, which is fetched in ./deps when runing make. Then when creating the eclipse project and pressing "discover paths", you will get all dependencies. The full suport for rebar projects is in the works.

There will probably still be errors, mostly because of the lager parse transform, which is not well supported by erlide. It doesn't know that it should compile the parse transform first. Usually, doing a clean and rebuild (from eclipse) might help.

@blacklightknight
Copy link
Author

Yes I already did build ejabberd as you can see here I have got the dependency folder:
abc

@vladdu
Copy link
Collaborator

vladdu commented Mar 7, 2017

And you created the eclipse project after that, using the "discover paths" button? In the project properties you should see all the deps/.../src and deps/.../include directories.

@blacklightknight
Copy link
Author

yes exactly, but still the problem continues.

@vladdu
Copy link
Collaborator

vladdu commented Mar 7, 2017

Very strange! It works for me... Do you have "Project->Build automatically" enabled? Did you try "Project->Clean"?

Please go to Window->Preferences->Erlang->Report problems, create a report and send it to me (or attach it here). Maybe I can see something there.

@blacklightknight
Copy link
Author

Yes my "Project->Build automatically" is enabled and I did use "Project->Clean"

@vladdu
Copy link
Collaborator

vladdu commented Mar 9, 2017

Please attach an problem report like described above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants