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 ...
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. ...
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 += " <...
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 ...
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 ...
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()...
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 ...
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 ...
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 ...
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 ...
4
votes
Accepted
'DynamicJsonBuffer' was not declared in this scope
Did you forget to include the ArduinoJSON header file:
#include <ArduinoJson.h>
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 ...
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)
{
...
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 ...
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.
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 ...
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 = ...
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 == ...
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 ...
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
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_ ...
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;
...
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 ...
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 ...
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 ...
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. ...
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
compilation-errors × 131arduino-ide × 31
arduino-uno × 20
library × 14
esp8266 × 10
c++ × 10
programming × 9
compile × 7
arduino-mega × 6
nodemcu × 5
avr-gcc × 5
esp32 × 4
string × 4
code-review × 4
error × 4
serial × 3
arduino-nano × 3
interrupt × 3
arduino-due × 3
c × 3
adafruit × 3
array × 3
sketch × 3
avrdude × 3
attiny85 × 3