Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

None existant errors (MPLAB X)

Pommie

Well-Known Member
Most Helpful Member
I've got a project and MPLAB X underlines all the variables (PORTA etc.) in the include file with a red line and says it can't find the include file.
The error is,
mplabx.png

When I hold Ctrl as suggested, I get this,
mplabx.png

The file compiles without warnings or errors.

Anyone and idea how to solve this?

Thanks,

Mike.
 

Nigel Goodwin

Super Moderator
Most Helpful Member
I've got a project and MPLAB X underlines all the variables (PORTA etc.) in the include file with a red line and says it can't find the include file.
The error is,
View attachment 137200
When I hold Ctrl as suggested, I get this,
View attachment 137201
The file compiles without warnings or errors.

Anyone and idea how to solve this?

Thanks,

Mike.
No, but I get the same issue occasionally - and sometimes only part of the include file names appear to be missed out, with the rest working, and defines sometimes don't highlight in blue either.
 

tumbleweed

Active Member
The dreaded mplabx "red squigglies". Search the microchip forums and you'll get 1000's of hits.
I don't think there's a single "this fix works for all situations" answer.

The accepted resolution seems to be if it compiles ok then ignore it. Isn't that great?
 

Pommie

Well-Known Member
Most Helpful Member
Isn't that great?
Microchip need to debug there software.

It doesn't really matter when the code is small but when it grows, it'd be nice to see the errors that are actually real rather than the forest of nonsense errors that hide the trees amoungt the forest.

I hate MPLAB X.

Mike.
 

rjenkinsgb

Well-Known Member
Most Helpful Member
I find it's usually It's usually variable or function names that are built in to the compiler, rather than being defined in an include file that MPLab can parse so it recognises them.
That's down to the way a specific compiler works, rather than a fault in MPLab.
Every variable should ideally be visible / defined for the editor, else it cannot know it's not an error or omission.

Sometimes it also seems to come from nested includes that have not been fully parsed - but those usually vanish after the first compile.

I routinely use the "production - Clean and build" menu option as a quick checker for any syntax or compile problems, then only use the debug or programming functions after verifying everything compiles correctly.
 

Pommie

Well-Known Member
Most Helpful Member
I find it's usually It's usually variable or function names that are built in to the compiler, rather than being defined in an include file that MPLab can parse so it recognises them.
That's down to the way a specific compiler works, rather than a fault in MPLab.
Every variable should ideally be visible / defined for the editor, else it cannot know it's not an error or omission.

Sometimes it also seems to come from nested includes that have not been fully parsed - but those usually vanish after the first compile.

I routinely use the "production - Clean and build" menu option as a quick checker for any syntax or compile problems, then only use the debug or programming functions after verifying everything compiles correctly.
The compiler can see ALL of the includes as it compiles without error. It's a bug in MPLAB X that needs fixing. I've copied the include files into the project directory and that fixes the problem, how do you explain that other than a buggy compiler or IDE. Are you suggesting that PORTA is defined in the compiler? It redlines ALL the SFR names in my file.

Mike.
 

Pommie

Well-Known Member
Most Helpful Member
This is the extent of it,
mplabx.png

And it still compiles fine, even though every single line has an error. Except, while(1).

Any explaination?

Mike.
 

rjenkinsgb

Well-Known Member
Most Helpful Member
I don't normally use the MPLab compilers, I use the CCS one. That has the occasional oddity in the IDE, but nothing like as bad as you describe.

The only XC example I have is that rotating beacon emulation I did some time ago.
Digging thought that, it uses multiple levels of nested includes, ending up with a "pic18_chip_select.h" file - presumably those exist for pic16, pic24 etc as well.

That includes only the exact device specific file.
In this case it includes pic18f452.h

The port A - B - C registers (and a few others that may be accessed as a whole rather than bits) have this style of definition, to trick the IDE into seeing a definition without upsetting the compiler:

#define PORTA PORTA

Some registers have the address hidden in an asm line, whish may mess up the IDE recognition??

asm("SPBRG equ 0FAFh");

What happens if you add the #include for the specific device first, so it's not hidden away?
 

Pommie

Well-Known Member
Most Helpful Member
I copied the "missing" include file into the project directory and included with quotes and that fixed it for one compile and then it came up with an error (on subsequent compiles) that I had no idea what it meant. So, compiled fine once and an error after that!!!!!!! This thing is broken. Microchip need to fix it.

Mike.
 

rjenkinsgb

Well-Known Member
Most Helpful Member
This is the extent of it,
Yuk...

With the CCS compiler, you have to add your own definition for any register you want to access directly - but for most things, you don't need that as the initial defs for the compiler and its peripheral setup functions do it all for you..

It puts underlines on all compiler built-ins on the initial load of a project, though they disappear after building it for the first time (not using the quick production one, as I thought - but they do not re-appear when that is used afterwards).

mplab_red_1.jpg



mplab_red_2.jpg
 

rjenkinsgb

Well-Known Member
Most Helpful Member
I copied the "missing" include file into the project directory and included with quotes and that fixed it for one compile and then it came up with an error

What happens if its after the xc.h include? It should only be read then if the IDE or compiler has not used the buried copy?
 

Pommie

Well-Known Member
Most Helpful Member
I've now got a new warning,
main.c:27:10: warning: non-portable path to file '"pic16f1827.h"'; specified path differs in case from file name on disk [-Wnonportable-include-path]

But only after the second compile!

Madness.

Mike.
 

granddad

Well-Known Member
I get same red squiggles at the start of an edit session, but they give up after a few edits and builds. does the navigator have any flags on the list of functions , also some times i 'think' comments can confuse the poor thing , to many // and /* ..
 

Pommie

Well-Known Member
Most Helpful Member
You've already said it compiles fine, just ignore any minor cosmetic issues :D
There's no point in having real time error highlighting if all it does is flag everything as an error. I could have wrote that system in about 5 minutes. I'd just like the option to turn it off.

You've got as much chance of that happenning as finding the pot of gold at the end of a rainbow
Waiting for rain.:D

Mike.
 

Latest threads

Top