Error code - main.cpp:43: undefined reference to 'setup' and ..."loop"

I'm a newbie. I'm trying to use an Arduino Industrial 101 to read a Grove temperature sensor (TSYS01). The problem is that I keep getting the same error on compile...

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/main.cpp:43: undefined reference to `setup'

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86__mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino/main.cpp:46: undefined reference to `loop'

This happens for any code I try to compile that would operate these sensors. I've tried three different scripts that I found on GitHub and they all produce the same error. Help!

An Arduino sketch requires these two functions:

void setup() {}
void loop() {}

Look in the File->Examples menu for example sketches. For each library you install (Sketch->Include Library->Manage Libraries...) there will typically be a few additional examples specific to that library.

Thanks very much! I'll try that. ...boy this is some learning curve...

If you define your own main function and override the main function that is defined by the Arduino IDE, then there is some initialization and other things that may get missed.

My best suggestion is to avoid main and learn to use setup and loop.
My second-best suggestion, in case you do not use my best suggestion above, is to take your code out of main, put the code in setup, and get rid of the main function and anything else named main. You will at least need an empty loop function also.

By the way, the error messages tried to tell you what was wrong, and told you where to find the Arduino IDE main.cpp if you want to see what it does.

I'm taking your advice and I'm learning to use setup and loop. The problem I'm now having is that my I2C sensor (a Grove temperature sensor board) is not getting power from the Arduino. I used a voltmeter on all the ground and power pins on the Arduino and there's nothing. Am I supposed to initialize the 5V pins somehow?

Am I supposed to initialize the 5V pins somehow?

No.

...then I suspect my board has a problem.

Thanks, you guys.

Are any LEDs on yhe board on?

Cool video!

...ummm... I got it working. What I did wrong is just too embarrassing to tell. But when your world isn't making sense, it's a good idea to check your instruments. And their cables.

Many of us have had similar problems so it may not be as embarrassing as you may think. I am glad that you have it working.