MPLAB X 1.2 Include Paths

Post
pntbll1313
Starting Member
2012/06/07 07:30:20
I am trying to include header files in my project that are inside a folders in my src directory. When I include the directories under the xc32-gcc proerties the project complies fine but I still get warnings that it cannot find the headers.
 
An example is in my main.c which is in my src folder, I have a #include "typedef.h", which is located in a folder called INTERFACE_COM_PIC32MX795F512L_STD.
 
Unresolved directive #include "typedef.h"
Analyzed system include paths:
C:\Program Files\Microchip\xc32\v1.00\bin/../lib/gcc/pic32mx/4.5.1/include
C:\Program Files\Microchip\xc32\v1.00\bin/../lib/gcc/pic32mx/4.5.1/../../../../pic32mx/include
 
 
If I use  #include "INTERFACE_COM_PIC32MX795F512L_STD/typedef.h" it works fine. This would not be a big deal but I am trying to recompile many projects from mplab 8.53 and I do not want to go into every c file and change all my includes. The include directories under the xc32-gcc proerties must be working because if I don't include ./src/INTERFACE_COM_PIC32MX795F512L_STD I get a fatal error: typedef.h: No such file or directory. Is it truly not finding the header file and is there some option that I'm not seeing to make the paths work properly? I've already made the File Path Mode in the Project Options under Embedded options Auto.
pntbll1313
Starting Member
Re:MPLAB X 1.2 Include Paths 2012/06/11 13:10:56
Update:
 
It looks like only the parser is not correctly finding the files. My project.x and src folders are in the same directory. Some of my header files are in the src folder and some are inside other folders in the src directory.
 
Does the parser for MPLAB X not support nested folders? Inside my src folder I have other folders that hold my header files. My main.c is located inside my src folder as well as some headers. Any header header that is directly in the src folder is found correctly by the parser but any header that is inside a folder a level down (I include "../src" and "../src/INTERFACE_COM_PIC32MX795F512L_STD" in my gcc include directories) is not found. The code still compiles fine as the include directories seems to be working in the gcc options but I get cannot find include file "typedef.h" if I hover over the include statements where the warning comes up.
 
This was obviously not a problem in MPLAB 8.53 as that function did not exist. I am currently using MPLAB X 1.20. Basically my question is how to make MPLAB X find the headers without either moving all .h files to the same folder as the .c that includes them or using a more complete path such as #include "INTERFACE_COM_PIC32MX795F512L_STD/typedef.h". If I had to do that what is the point of letting me include multiple directories anyway?
MrRed
New Member
Re:MPLAB X 1.2 Include Paths 2012/06/11 13:24:54
I've had problems with the parser when more than one project was open in the workspace at once.  For whatever reason it always took the include path of the first (top) project even when the other project was selected as the active/main project.
 
The parser will tell you the include path it used when you hover the mouse over the include (might need to hold ctrl or alt key).
pntbll1313
Starting Member
Re:MPLAB X 1.2 Include Paths 2012/06/11 13:52:36
I did have a few projects open but just closed them all and the problem still persists when only one project is open. For any of the .h files in the src directory it finds them just fine when I hover over them with the ctrl key but if the header is in another folder it can’t find it. I don’t think the parser even looks at what I have included in my gcc include directories and I would like to figure out a way for it to do so.
 
I have a .h file in my src folder called systemSettings.h and it finds it just fine when I hover over it.
File C:\PROJECTS\12345_test\src\systemSettings.h
From project 12345
 
I have a .h file in my \src\INTERFACE_COM_PIC32MX795F512L_STD folder called typedef.h and it will not find it.
Unresolved directive
#include "typedef.h"
 
If I were to change the path to #include "INTERFACE_COM_PIC32MX795F512L_STD/typedef.h" the parser will find it.
File C:\ PROJECTS\12345_test\src\INTERFACE_COM_PIC32MX795F512L_STD\typedef.h
From project 12345
 
Is there some place I can enter include paths specifically so the parser will look for them?
DATI
New Member
Re:MPLAB X 1.2 Include Paths 2012/06/12 04:33:50
I had a similar problem. I started opening and closing multiple projects and Set them as "Main Project". After a combination i don't remember, it started working correctly. 
pntbll1313
Starting Member
Re:MPLAB X 1.2 Include Paths 2012/06/12 07:25:07
I repeated the steps by opening and closing projects with no luck. I then switched back to my C32 compiler v2.02 and the parser works! I had been using the new XC32 v1.00 and seeing this problem. I swear this I saw this problem earlier and tried switching between compilers but maybe the opening/closing/setting as main did fix my problem for the C32.
 
I'll start looking in the XC32 forum for a solution now but if someone knows a fix please post it here. I was under the impression that C32 v2.02 and XC32 v1.00 wouldn't be too different but I guess I was wrong.
 

Guest
Super Member
Re:MPLAB X 1.2 Include Paths 2012/06/12 08:48:22
I have the same problem, MPLABx 1.2 and Xc32 V 1.00. 
 
I hope that someone from Microchip will give us a solution because is very frustrating to work without any of the new editor features of MPLABx. In my case, as the parser don't recognize the .h files, also don't find the definitions inside and shows the more of the code as inactive. 
 
 
vinbedded
Starting Member
Re:MPLAB X 1.2 Include Paths 2012/06/12 10:11:25
I am having the same problem using MPLABX 1.2 and XC32.  I go to C32 and no issues.
DATI
New Member
Re:MPLAB X 1.2 Include Paths 2012/06/13 00:44:27
The problem hase come back, so i also changed to C32. First it was ok, but now sometimes it doesn't work. It is really annoying, because most of my code also shows as inactive because of definitions in header files. 
 
When MPLAB X beta came out, i liked it. But version 1.10 and 1.20 versions has so many bugs.
sggaunt
Super Member
Re:MPLAB X 1.2 Include Paths 2012/06/13 00:54:26
I have problem with this as well, MPLabX will mark some includes as unable to locate, but then it compiles OK!
Tried all sorts of things, just when you think you have the answer the problem persists.
There should be some detailed  notes on how to set up includes in X
 
Guest
Super Member
Re:MPLAB X 1.2 Include Paths 2012/06/13 01:09:28
I have exactly the same problem with MPLabX and XC32!
Guest
Super Member
Re:MPLAB X 1.2 Include Paths 2012/06/13 01:49:39
i also have the same problem....can someone help us
 
jb007
New Member
Re:MPLAB X 1.2 Include Paths 2012/06/13 03:13:55
I also have same problem: Using MPLabX 1.2 and XC32 1.00. How did this get pass QC![8D]
Guest
Super Member
Re:MPLAB X 1.2 Include Paths 2012/06/13 05:09:59
I've solved the problem grin, or at least I've avoided it sad. The only thing I did was using gcc32, not Xc32. 
pntbll1313
Starting Member
Re:MPLAB X 1.2 Include Paths 2012/06/14 06:09:32
I find it odd that no administrator has commented with a solution or to admit there is a bug and that it is being resolved in the next version. I would like to verify that Microchip is actually going to fix this bug either with their XC32 compiler version or MPLAB X. Until that time in my opinion XC32 and MPLAB X are just not compatable and with the 8 people above also having this issue I'm suprised they're not trying to resolve it.
slevine000
Starting Member
Re:MPLAB X 1.2 Include Paths 2012/06/15 17:25:06
Strange.  You can Navigate -> Go To Header from a source file and it has no problem opening a file that it says it "Cannot find" when pointed to in the source. It knows where they are, sort of.
 
And MPLAB X has always had a problem when multiple projects are open.  If a header file is in more than one project, e.g., "A" and "B", and you click on the file name from a source in project "B", it opens the file, but uses the macros from project "A" (alpha order) which can be confusing.
jb007
New Member
Re:MPLAB X 1.2 Include Paths 2012/06/15 22:01:17
I got a reply from support. Not a very elegant solution, but at least a solution. Here it is:
 
Problem Resolution: 
Hi 
This is a known issue & has been entered into our bug tracking tool. 
This issue occurs if a direct include path like "timer.h" is included in the code and relative path to search is 
mentioned under build options : 'xc32-gcc >> Include Directories'.

Include the header file relative to the parent directory as "../../include/timer.h" and remove the Include Directory path under 
the build options : 'xc32-gcc >> Include Directories'

This will prevent the messages from occuring. 
Please write back to us, if you have any more questions. 
Thanks 
Amit


Guest
Super Member
Re:MPLAB X 1.2 Include Paths 2012/06/16 09:09:32
That solution does work but it is not helpful when re-compiling large amounts of code without having to go into every .c file and change the paths. Especially since from the compilers point of view it's not changing anything and it is just much more work for the programmer. We are trying to recompile all our code with MPLAB X and XC32 but it is turning out to be much more work than it has to.
 
 
jb007
New Member
Re:MPLAB X 1.2 Include Paths 2012/06/16 17:32:10
Guest

That solution does work but it is not helpful when re-compiling large amounts of code without having to go into every .c file and change the paths. Especially since from the compilers point of view it's not changing anything and it is just much more work for the programmer. We are trying to recompile all our code with MPLAB X and XC32 but it is turning out to be much more work than it has to.



As I said, not a very elegant solution. It would be nice if Microchip gave some timeline on a fix or patch!sad
sggaunt
Super Member
Re:MPLAB X 1.2 Include Paths 2012/06/18 06:17:05
BTW I see these issues using the C30 Compiler.
XGenerator
Administrator
Re:MPLAB X 1.2 Include Paths 2012/06/22 11:58:39
We have found an issue with the XC32 plugin that parses the system include files to the parser. This is fixed int he 1.30 version available soon.
Howewver we have also identified that at times (adding a file and others) the parser will not always refresh. We have a bug issue for this and will look at it for 1.40.
Thanks
 
branek
Starting Member
Re:MPLAB X 1.2 Include Paths 2012/07/10 03:56:55
Hi to all,
 
I experienced same issue after migrating from Win version to Linux version of MPLAB X 1.30 and XC16 V1.0.
After changing backslashes into slashes under xc16-gcc include directory I spotted that on some places in /nbproject/configurations.xml these backslashes are not changed. I changed it manually and now I have parser working.
 
Backup configurations.xml before any edit.
 
Branko
Steve S
New Member
Re:MPLAB X 1.2 Include Paths 2012/07/11 22:31:30
I've been using MPLAB for many years and I cannot get MPLAB X to build unless I manually change each and every #include directive to include the full path.  Even that does not always work because MPLAB X invokes #includes that I don't want, can't use, and can't turn off.  The latest problem is that a project fails to build because it can't find "chip_select.h".  This header file is apparently used for MPLAB REAL-ICE related macros which I don't use.  How can I turn this bloody stupid feature off!!!  MPLAB X is not a usable product with this kind of problem.
 
Under MPLAB 8.x all you have to do is click on Project, Build, Project, and all of the paths can be set globally in a snap.  So this ability was removed in MPLAB X??  Seriously?
vloki
always on da run
Re:MPLAB X 1.2 Include Paths 2012/07/11 23:56:14
Project Properties -> Categories: *your compiler* -> Include directories ...
jjmontero9
New Member
Re:MPLAB X 1.2 Include Paths 2012/08/04 09:08:05
I'm having the same problem.
1. I included headers in my project.
2. I declared them in the source.
 
This is what is happening

 
I thought Java 7 was the problem.
So I uninstalled Java 7 and installed Java 6 R33.
Still no luck.
 
Files are missing and this happens every time I try to include a header this way.
Any ideas?
sggaunt
Super Member
Re:MPLAB X 1.2 Include Paths 2012/08/06 01:17:33
Putting a header filer into the project tree, does not include it in your build. (same with any version of MPLab and most other IDEs)
It just so you can open the headers in the editor as required, Previous versions of MPLab had a means of specifying your library (headers etc) locations, In X is it not so clear.
If you type "#include" then add a Double quote or Left Arrow X will bring up a list of the '.h' files it can 'see' 
If it cannot see the ones you want well that's when the fun starts!
Here's a tip though look at the locations of the 'visible' headers and move your required headers to the same folder. Much simpler that trying to get the paths right (good grief)