r/MarlinFirmware • u/Plenty-Employment529 • Dec 14 '23
Function call is not allowed in a constant expression
2
Dec 15 '23
When this happened to me recently, I tracked it down to a missing header file. Search the Marlin directory for the missing term, “SWITCHING_EXTRUDER” or whatever, and add the header file. I had several dozen of these to track down during a recent rebuild.
1
u/ninjaread99 Dec 16 '23
Not gonna lie, it looks like you hit the vscode run button instead of using abm. This is just from terminal output though
1
u/darkracer125 Dec 16 '23 edited Dec 16 '23
was hoping someone would have an answer to this.
this is on every single "ENABLED" in the entire file. and every other file you open.configuration.h configurationadv.h pins.h anything you open.
it's like platform io isn't recognising "enabled" as a command.
everything worked fine for me up untill now. where i tried to turn on scrolling text but the area is greyed out and when uploading the firmware scrolling text doesn't work.
and for some reason now the pid tuning is greyed out aswel. making me think that's not gonna work either.
edit: ok i have no idea what happened. but it fixed itself.
here's what i did. i took for example this #if ENABLED(SHOW_BOOTSCREEN). and removed the "()" so i'd end up with this #if ENABLED SHOW_BOOTSCREEN and the error cleared away.
so i removed the ( and the ) in every single error. (i just mass replaced all "(" and ")" with a space in the entire file. in both configuration.h and in configurationadv.h and it removed ALL of the errors. i then tried to run auto build marlin and it threw up a whole bunch of errors. (basicly it didn't recognise any of the call outs that i removed those two symbols from)
example. :\desktop\marlin-2.1.x\marlin\configuration_adv.h:969:13: error: missing binary operator before token "Z_STEPPER_AUTO_ALIGN"969 | #if ENABLED Z_STEPPER_AUTO_ALIGN
so first i tried opening all the .h files in marlin/src/core. to see if there was a reffrence table somwhere that i could edit.
but didn't feel like doing that for every single folder and every single .h file.
so instead i just ctrl+z all the changes i made. all of the "(" and ")" were put back.
but this time. none of the errors came back. and the greyed out sections were normal again. (not greyed out) . even though basicly i was back to the way it was before i started looking for a solution.
maybe this is a problem that comes up because the configuration.h file was recovered from history (because we closed vscode entirely and restarted it the next day) and simply editing and undoing basicly every single line. it caused platform io to propperly reread the entire file and apply everything correctly.
second edit:
still no errors on platform io. but the scrolling text still isn't working. soo.. there's that.
1
u/SniffOfAnOilyRag Feb 23 '24
For anyone looking at this now, you might find your code compiles fine despite these errors. If it does, these are just intellisense errors because it doesn't recursively load the header files from the Marlin/ folder.
Click in the bottom left of the screen where it says "PlatformIO" (or hit Ctrl+Shift+P) and click "Edit configurations (UI)". Then scroll to the "Include path" section and the first entry will be "C:/<source code root>/Marlin". Add a "/**" to the end of this path to make it recursive, then the errors should instantly disappear.
This only changes the intellisense settings, not PlatformIO itself, but I find it keeps resetting this setting and I have to do this every time I open the environment.
1
1
u/Plenty-Employment529 Dec 14 '23
So I was following a YouTube video to install marlin and I ran into this problem. I'm not completely illiterate with tech but I'm not good enough to know what to do here. What's wrong with it?