Visual Studio Code compiler

9 views
Skip to first unread message

Richard Langner

unread,
Sep 25, 2021, 5:02:29 AMSep 25
to Sheffield Hardware Hackers
I'm trying to compile ESP8266 code (Arduino) using Visual Studio Code
with PlatformIO.

The code compiles without error on my Win10 desktop PC, but not on my
Win10 laptop.
Settings are the same as far as I can tell.

On the laptop I get the scores of messages which seem to refer to the
libraries I use:
ISO C++17 does not allow 'register' storage class specifier [-Wregister]

Is there a way to find out which compiler is installed and a way to
specify use of an earlier version of the compiler?

I've tried Google but I must be using the wrong search terms, so no
success...

Richard

Richard Langner

unread,
Sep 25, 2021, 5:32:33 AMSep 25
to Sheffield Hardware Hackers
Further to my email below, it seems the warnings are not preventing compilation.
Warnings are shown in yellow.
In red are the proper failures, and this one says that 'read' in 'FS.h' is the problem.
See attached image.
Can anyone help?


2021-09-25_103043.png

nop head

unread,
Sep 25, 2021, 6:37:40 AMSep 25
to Sheffield Hackspace
It says "note" so i think it is less than even a warning, not an error. Perhaps adding "override" to the declaration of read will get rid of it, but I think override is optional. C++ has changed a lot since I retired from being a programmer nearly 10 years ago!

--
You received this message because you are subscribed to the Google Groups "Sheffield Hackspace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sheffield-hardware-...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/sheffield-hardware-hackers/048e01c2-95e9-eacf-c60b-8be055142498%40gmail.com.

Graham Driver

unread,
Sep 25, 2021, 7:29:20 AMSep 25
to sheffield-har...@googlegroups.com
Have you checked the paths on the two machines?

From: sheffield-har...@googlegroups.com <sheffield-har...@googlegroups.com> on behalf of Richard Langner <richard...@gmail.com>
Sent: Saturday, September 25, 2021 10:32:30 AM
To: Sheffield Hardware Hackers <sheffield-har...@googlegroups.com>
Subject: [SHH:17248] Re: Visual Studio Code compiler
 

Richard Langner

unread,
Sep 26, 2021, 1:25:58 PMSep 26
to sheffield-har...@googlegroups.com
Desktop PC compiles OK
  "includePath": [
                "E:/Electronics and programming/VScode/2021-09-20 PixelCube WIP/include",
                "E:/Electronics and programming/VScode/2021-09-20 PixelCube WIP/src",

laptop does not compile
            "includePath": [
                "C:/VScode/2021-09-20 PixelCube WIP/include",
                "C:/VScode/2021-09-20 PixelCube WIP/src",

Desktop - no errors


Laptop finds an error in FS.h


The FS.h fault is


Are you in the 'space tomorrow? Perhaps we can try to sort it out.....

Richard

Graham Driver

unread,
Sep 26, 2021, 2:04:10 PMSep 26
to sheffield-har...@googlegroups.com
OK, will probably be there.

Send me whatever and i have a look first. OK?


Sent: 26 September 2021 17:25
To: sheffield-har...@googlegroups.com <sheffield-har...@googlegroups.com>
Subject: Re: [SHH:17252] Re: Visual Studio Code compiler
 

nop head

unread,
Sep 27, 2021, 6:36:33 AMSep 27
to Sheffield Hackspace
The error makes no sense because it says size_t conflicts with size_t. Unless there are two different definitions of size_t, perhaps by mixing libraries from 8 bit platforms with 32 bit platforms.


Graham Driver

unread,
Sep 27, 2021, 8:10:42 AMSep 27
to sheffield-har...@googlegroups.com
Richard - As I said it compiles OK for me.

I see you have FS.h in include folder. I do not.

AFAIK FS.h is part of the standard libraries found at "C:\Users\graha\.platformio\packages\framework-arduinoespressif8266\cores\esp8266\FS.h"

I have line 63 as "int read() override;" which is apparently not what you have. From what I can see I have your error line at 66 (no error of course). We may have different PIO versions anyway and do have a look at c_cpp_properties.json.

Does it compile if you remove the explicit reference? I see it is there on the working PC, but who knows?  You might have to restart VSC to make it forget the include reference. Maybe PROJECT TASKS, CLEAN.

Of course, this could all be complete b*****s.

From: sheffield-har...@googlegroups.com <sheffield-har...@googlegroups.com> on behalf of nop head <nop....@gmail.com>
Sent: 27 September 2021 10:33
To: Sheffield Hackspace <sheffield-har...@googlegroups.com>
Subject: Re: [SHH:17254] Re: Visual Studio Code compiler
 

nop head

unread,
Sep 27, 2021, 8:29:57 AMSep 27
to Sheffield Hackspace
Or perhaps they should all be int return types.

Graham Driver

unread,
Sep 27, 2021, 8:34:53 AMSep 27
to Sheffield Hackspace
There are several additions before the problem line.


Sent: 27 September 2021 12:26
To: Sheffield Hackspace <sheffield-har...@googlegroups.com>
Subject: Re: [SHH:17259] Re: Visual Studio Code compiler
 

Richard Langner

unread,
Sep 27, 2021, 10:46:49 AMSep 27
to sheffield-har...@googlegroups.com
It makes no sense to me either!
I will start a new project and gradually introduce each part until it fails, then see what it was.
The 'overwrite' after int read() means it can be over ridden providing the signature is the same, so I think it fails because it was declared as int and then later as size_t.


On 27/09/2021 11:33, nop head wrote:
The error makes no sense because it says size_t conflicts with size_t. Unless there are two different definitions of size_t, perhaps by mixing libraries from 8 bit platforms with 32 bit platforms.

nop head

unread,
Sep 27, 2021, 11:12:38 AMSep 27
to Sheffield Hackspace
virtual in the base class is what allows it to be overridden. read() normally returns -1 for errors, so it can't be size_t as that is unsigned. It used to be int but I think later versions use ssize_t for a signed size. It needs to match the return type of the virtual function in the base class.

Graham Driver

unread,
Sep 27, 2021, 12:17:52 PMSep 27
to Sheffield Hackspace
Well I have just updated PIO - the ESP8266 core went from 2.6.3 to 3.2.0

And now it does not compile...

1 error, and 79 warnings.

The one error is main.cpp line 476 "control reaches end of non-void function [-Werror=return-type]"



And that's all for now!


Sent: 27 September 2021 15:09
To: Sheffield Hackspace <sheffield-har...@googlegroups.com>
Subject: Re: [SHH:17262] Re: Visual Studio Code compiler
 

Richard Langner

unread,
Sep 28, 2021, 3:34:36 PMSep 28
to sheffield-har...@googlegroups.com
Update: the program now compiles.

Many thanks to Graham last night at the hackspace. He pointed out that 'FS.h' is already in the arduino/patformio IDE (I also had it in the 'include' folder), and he noticed that one function didn't have a return on all paths of an 'if' statement even though it would never be used (not my code). It helped that he saw all the code.

I still find it odd that it compiled on my desktop PC but not on the laptop, both Win10, VSC, PlatformIO, and updated. My guess is a different compiler version or its settings.

Thanks Graham, Nop and others. It's nice to know there's help out there.

Richard


On 27/09/2021 16:09, nop head wrote:
virtual in the base class is what allows it to be overridden. read() normally returns -1 for errors, so it can't be size_t as that is unsigned. It used to be int but I think later versions use ssize_t for a signed size. It needs to match the return type of the virtual function in the base class.

Reply all
Reply to author
Forward
0 new messages