Skip to main content
28 votes
Accepted

Why can't my IF statement see a global?

The backslash in your comments are the problem. As per C++ language definitions, a \ at the end of the line is interpreted as a "line continuation". Thus, your comment gets continued in the next line ...
Maximilian Gerhardt's user avatar
7 votes
Accepted

"stray '/302' in program error" when compiling

0302 is 0xc2. Somewhere in your source you have one or more non-breaking spaces (0xa0) encoded in UTF-8 (0xc2 0xa0). Use od or a similar tool to find them, and then replace them with normal spaces. ...
Ignacio Vazquez-Abrams's user avatar
7 votes
Accepted

NodeMCU and expected ';' before wrong ' " '

In C you can not use quotation marks inside quotation marks (thus nested). Replace message2 += " <meta name="viewport" content="width=device-width, initial-scale=1">"; to message2 += " <...
Michel Keijzers's user avatar
6 votes
Accepted

Own type definition using a struct does not name a type

This is a bug in the Arduino IDE: when converting your .ino file to a .cpp file, it added a declaration for the function ledFactory() before the declaration of the type led_t. As it appears to be ...
Edgar Bonet's user avatar
  • 44.3k
5 votes
Accepted

Ubuntu class string has no member remove

The remove method was added to the String class in 1.0.6. Installing Arduino IDE from the Ubuntu repository gets you a really old package (1.0.5). You should download and install the newest version ...
gre_gor's user avatar
  • 1,682
5 votes
Accepted

Project wont compile when I place functions below function calls

You need to declare your function before you use it. So either the whole function body needs to be before the usage, or you must add a function prototype declaration. void myfunction(); myfunction()...
David Jones's user avatar
5 votes
Accepted

Can't use uint16_t in library

Using #include <Arduino.h> in your myheader.h will also include <stdint.h> and probably solve this. The Arduino IDE automatically includes Arduino.h in the sketch itself, but apparently ...
ocrdu's user avatar
  • 1,795
5 votes
Accepted

How to enable exception handling on the Arduino Due?

First, we must make sure the "-fno-exceptions" compiler flag is overwritten with "-fexceptions". In addition, we must link a separate library that includes the compiler support ...
PMF's user avatar
  • 1,306
4 votes

The code is showing a error that "ledpin2 is not declared in the scope"

You mix capitals with non capital characters. The case of characters in variable names are important, so ledPin2 is a different variable than ledpin2. Also, never mix similar names (unless it is ...
Michel Keijzers's user avatar
4 votes

Compilation Error in nodeMCU along with oneWire temperature sensor ds18b20, and 2x16 LCD display (not I2C)

It appears you're using an outdated version of the OneWire library that does not support ESP8266. Please follow these instructions to upgrade to the latest release of the library: Sketch > Include ...
per1234's user avatar
  • 4,248
4 votes
Accepted

'DynamicJsonBuffer' was not declared in this scope

Did you forget to include the ArduinoJSON header file: #include <ArduinoJson.h>
jose can u c's user avatar
  • 6,974
4 votes

"stray '/302' in program error" when compiling

One cause of the /(302) error is copy and paste code from a word processor. You have ASCII codes copied that add spaces, etc to your code. Go through each identified line and remove any extra spaces ...
RogerR2's user avatar
  • 51
4 votes
Accepted

What is wrong with this code?

if (rightStickVerticalPwm == 0) { servo1.write(elevatorServoStop); } else if (rightStickVerticalPwm > 1500) { servo1.write(100); } else (rightStickVerticalPwm < 1400) { ...
Maximilian Gerhardt's user avatar
4 votes

Break a big file into smaller files

This is not the right way to split a big .ino file. You should instead think in terms of functional units, i.e. software “modules” that address specific concerns. For example, if a subset of your code ...
Edgar Bonet's user avatar
  • 44.3k
3 votes
Accepted

Arduino library not working, can't find header

You spelled the header filename wrong: #include "SegDispaly.h" should be: #include "SegDisplay.h" You have also made the same mistake in the class name multiple places in SegDisplay.cpp.
per1234's user avatar
  • 4,248
3 votes
Accepted

i586-poky-linux-g++: no such file or directory Error compiling for board Intel® Edison

The problem here is that Intel, in their infinite wisdom* have lots of hard-coded paths to libraries in the binaries (why, heaven only knows) and then a set of scripts that munge those binaries to ...
Majenko's user avatar
  • 106k
3 votes
Accepted

compile error when using two typename in template class

In this class declaration: class Test { public : Test(); ~Test(); Map<int, String> *list = new Map<int, String>(); }; This line is wrong: Map<int, String> *list = ...
Nick Gammon's user avatar
  • 38.7k
3 votes

error: expected primary-expression before '(' token

You seem to have been programming in Java recently, because many of your errors have a Java ‘whiff’ to them. This, as you’ve tagged, is C++, not Java. sendMouseState: a. You wrote leftPressed == ...
John Burger's user avatar
  • 1,875
3 votes
Accepted

How to deal with this array correctly?

You don't want an array of strings containing the (badly formatted) names of variables. Instead you want an array of 32-bit integers containing the values held within those variables. const uint32_t ...
Majenko's user avatar
  • 106k
3 votes

Strange compiler error (Segmentation Fault)

This is a known fault with the compiler in Windows. The annoying thing is that it's the version of the compiler that is included in the Windows Store App version of the Arduino IDE. It also snuck ...
3 votes
Accepted

Selected board depends on 'arduino' core (not installed)

I needed to install the boards package for: Arduino AVR Boards Under Tools -> Board -> Board Manager
Tom Hale's user avatar
  • 431
3 votes
Accepted

Two libraries collide. Ambiguous functions/variables?

The DEBUG_ functions in the DGS class are private and used only in DGS.cpp. They will not collide with the macros from DHT.h If DHT.h is included before DGS.h, the preprocessor replaces the DEBUG_ ...
Juraj's user avatar
  • 18.2k
3 votes
Accepted

Unable to declare variable in a library that doesn't have a class: multiple definition of the variable

In Lib.h you should declare an extern int myVariable; In Lib.cpp you can define it once #include "Lib.h" int myVariable=123; ...
DataFiddler's user avatar
  • 1,045
3 votes
Accepted

Unable to compile c++11 libraries despite having added -std=c++11 in platform.txt

The AVR-based Arduinos don't come with anything close to a full C++ standard library implementation. They have avr-libc which is fairly complete to at least the C99 standard, that is the C standard ...
timemage's user avatar
  • 5,414
3 votes
Accepted

Problem in upload bootloader into esp32

esp32 has a fixed bootloader in read only memory. it is not replaceable ArduinoISP sketch is a programmer only for classic ATmega MCU boards in valid case you would have to select the programmer in ...
Juraj's user avatar
  • 18.2k
3 votes

Break a big file into smaller files

If you split the file into multiple .ino files, then the compiler will concatenate them all into one long .ino file before it compiles. It will put the one that matches the name of the project first ...
Delta_G's user avatar
  • 3,390
2 votes

Compilation Error: "cannot declare 'client' to be of abstract type 'Client'"

You can't use Client directly like that. It's just an abstract class. You have to use one of the classes like EthernetClient or WiFiClient that implements it. Client is like a shell of a class. ...
Delta_G's user avatar
  • 3,390
2 votes
Accepted

Suddenly I can't compile any sketch. Not even a blink sketch that I compiled earlier

So I seem to have fixed it. One way or another, I think VisualMicro suffered some type of problem with the installed boards. My first clue was that my sketches still compiled int the native Arduino ...
LegitimateWorkUser's user avatar
2 votes

Suddenly I can't compile any sketch. Not even a blink sketch that I compiled earlier

There are a few suggestions here, here and here: Ensure you are using the latest Arduino software that is compatible with Visual Micro (this is not necessarily the latest Arduino software!) Go to ...
MechtEngineer's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible