Go Down

Topic: expected initializer before void (Read 3721 times) previous topic - next topic

I am trying to compile my Arduino sketch (https://github.com/mchr3k/arduino/blob/master/wsn_arduino/wsn_arduino.ino) and I am getting a very strange error.

wsn_arduino:-1: error: expected initializer before 'void'
wsn_arduino:-1: error: expected initializer before 'void'
wsn_arduino:13: error: expected initializer before 'void'

I know that this error usually indicates a missing semi colon. However, I'm not sure how I can have missed a semicolon on line -1 and I can't actually spot any missing semi colons.

Can anyone else spot my mistake or suggest what this error means in my case?

PaulS

I don't know what you expect us to do with that link. All I see are a bunch of confusing links to other place. I have no idea where to go to find your code, nor much interest in trying. Post your code in a code window or as an attachment to the post, if the code is too large.

Coding Badly


Make the message window larger and you will see the light...

Code: [Select]
sketch_mar14a.cpp:3:24: error: MANCHESTER.h: No such file or directory
sketch_mar14a.cpp:4:26: error: SerialReader.h: No such file or directory
In file included from C:\Projects\Arduino\Sketch\libraries\SdFat/SdFat.h:26,
                 from sketch_mar14a.cpp:5:
C:\Projects\Arduino\Sketch\libraries\SdFat/SdFile.h:36: error: conflicting return type specified for 'virtual void SdFile::write(uint8_t)'
C:\Arduino\arduino-1.0\hardware\arduino\cores\arduino/Print.h:48: error:   overriding 'virtual size_t Print::write(uint8_t)'
sketch_mar14a:-1: error: expected initializer before 'void'
sketch_mar14a:-1: error: expected initializer before 'void'
sketch_mar14a:13: error: expected initializer before 'void'


I don't know what you expect us to do with that link. All I see are a bunch of confusing links to other place. I have no idea where to go to find your code, nor much interest in trying. Post your code in a code window or as an attachment to the post, if the code is too large.


I'm not sure why the link isnt working for you. It is a direct link to my .ino file hosted on GitHub. Clicking the link works fine for me. I will attach the source file directly later today when I am back at a PC.



Make the message window larger and you will see the light...

Code: [Select]
sketch_mar14a.cpp:3:24: error: MANCHESTER.h: No such file or directory
sketch_mar14a.cpp:4:26: error: SerialReader.h: No such file or directory
In file included from C:\Projects\Arduino\Sketch\libraries\SdFat/SdFat.h:26,
                 from sketch_mar14a.cpp:5:
C:\Projects\Arduino\Sketch\libraries\SdFat/SdFile.h:36: error: conflicting return type specified for 'virtual void SdFile::write(uint8_t)'
C:\Arduino\arduino-1.0\hardware\arduino\cores\arduino/Print.h:48: error:   overriding 'virtual size_t Print::write(uint8_t)'
sketch_mar14a:-1: error: expected initializer before 'void'
sketch_mar14a:-1: error: expected initializer before 'void'
sketch_mar14a:13: error: expected initializer before 'void'



Unfortunately I have already tried expanding the message window. The errors which I posted are the only error output which I get even when I turn on verbose compilation.

If you are trying to reproduce my issue you will need to add all of the same libraries to your arduino workspace libraries folder: https://github.com/mchr3k/arduino/tree/master/libraries. This includes the latest SdFat library which I think fixes the error you are getting.

Unfortunately I can't do better than linking to GitHub as I am posting from my phone. I will try to put together a more helpful zip of the required files later today.

Coding Badly


[font=Courier New]NOINLINE[/font] is not defined.  Remove it from your sketch.



[font=Courier New]NOINLINE[/font] is not defined.  Remove it from your sketch.



Perfect - this has fixed my problem. Thanks!

This was valid when I was using SD.h which wrapped an older version of SdFat that defined this constant. I updated to use a newer version of SdFat directly and this caused my problem.

https://github.com/mchr3k/arduino/commit/16445a302c34d0a65f88d80fe0203f9072bac4b7

Go Up