Skip to main content
Post Closed as "Needs details or clarity" by VE7JRO, Juraj, MichaelT, sempaiscuba, esoterik
edited example code to be able to copy paste it into editors
Source Link
Jan
  • 103
  • 3

I use VSCode, not the Arduino IDE. I saw and tried to use a lot of code snippets which are provided for Arduino projects...

So when I copy/paste these examples into my VSCode and try to compile it fails. (I won't believe that people offer non-working examples.)

When I place the functions above the function calls it compiles.

Is this normal behavior or do I have to add some settings to get this working as provided?

FailsFails in VSCode (works in Arduino IDE):

myfunction(); void myfunction(){ return 0; } 
#include "Arduino.h" void setup() { } int zero = 0; void loop() { zero = myfunction(); } int myfunction(){ return 0; } 

WorksWorks in VSCode (Works in Arduino IDE):

void myfunction(){ return 0; } myfunction(); 
#include "Arduino.h" void setup() { } int zero = 0; int myfunction(){ return 0; } void loop() { zero = myfunction(); } 

I use VSCode, not the Arduino IDE. I saw and tried to use a lot of code snippets which are provided for Arduino projects...

So when I copy/paste these examples into my VSCode and try to compile it fails. (I won't believe that people offer non-working examples.)

When I place the functions above the function calls it compiles.

Is this normal behavior or do I have to add some settings to get this working as provided?

Fails:

myfunction(); void myfunction(){ return 0; } 

Works:

void myfunction(){ return 0; } myfunction(); 

I use VSCode, not the Arduino IDE. I saw and tried to use a lot of code snippets which are provided for Arduino projects...

So when I copy/paste these examples into my VSCode and try to compile it fails. (I won't believe that people offer non-working examples.)

When I place the functions above the function calls it compiles.

Is this normal behavior or do I have to add some settings to get this working as provided?

Fails in VSCode (works in Arduino IDE):

#include "Arduino.h" void setup() { } int zero = 0; void loop() { zero = myfunction(); } int myfunction(){ return 0; } 

Works in VSCode (Works in Arduino IDE):

#include "Arduino.h" void setup() { } int zero = 0; int myfunction(){ return 0; } void loop() { zero = myfunction(); } 
Fixed syntax highlighting.
Source Link
VE7JRO
  • 2.5k
  • 19
  • 28
  • 31

I use VSCode, not the Arduino IDE. I saw and tried to use a lot of code snippets which are provided for Arduino projects...

So when I copy/paste these examples into my VSCode and try to compile it fails. (I won't believe that people offer non-working examples.)

When I place the functions above the function calls it compiles.

Is this normal behavior or do I have to add some settings to get this working as provided?

Fails:

myfunction(); void myfunction(){ return 0; } 
myfunction(); void myfunction(){ return 0; } 

Works:

void myfunction(){ return 0; } myfunction(); 
void myfunction(){ return 0; } myfunction(); 

I use VSCode, not the Arduino IDE. I saw and tried to use a lot of code snippets which are provided for Arduino projects...

So when I copy/paste these examples into my VSCode and try to compile it fails. (I won't believe that people offer non-working examples.)

When I place the functions above the function calls it compiles.

Is this normal behavior or do I have to add some settings to get this working as provided?

Fails:

myfunction(); void myfunction(){ return 0; } 

Works:

void myfunction(){ return 0; } myfunction(); 

I use VSCode, not the Arduino IDE. I saw and tried to use a lot of code snippets which are provided for Arduino projects...

So when I copy/paste these examples into my VSCode and try to compile it fails. (I won't believe that people offer non-working examples.)

When I place the functions above the function calls it compiles.

Is this normal behavior or do I have to add some settings to get this working as provided?

Fails:

myfunction(); void myfunction(){ return 0; } 

Works:

void myfunction(){ return 0; } myfunction(); 
Source Link
Jan
  • 103
  • 3

Project wont compile when I place functions below function calls

I use VSCode, not the Arduino IDE. I saw and tried to use a lot of code snippets which are provided for Arduino projects...

So when I copy/paste these examples into my VSCode and try to compile it fails. (I won't believe that people offer non-working examples.)

When I place the functions above the function calls it compiles.

Is this normal behavior or do I have to add some settings to get this working as provided?

Fails:

myfunction(); void myfunction(){ return 0; } 

Works:

void myfunction(){ return 0; } myfunction();