Programming with .cpp .h and .cpe files

I'm trying to get the following sample code to work:

http://playground.arduino.cc/ComponentLib/Thermistor4

When I create the project, the cpe code gets converted to an ino file. I already figured out that <WProgram.h> needs to be changed to <Arduino.h>

However, it still won't compile:

core.a(main.cpp.o): In function main': /home/johnz/sketchbook/arduino-1.6.5-r5/hardware/arduino/avr/cores/arduino/main.cpp:40: undefined reference to setup'
/home/johnz/sketchbook/arduino-1.6.5-r5/hardware/arduino/avr/cores/arduino/main.cpp:43: undefined reference to `loop'
collect2: error: ld returned 1 exit status
Error compiling.

What am I doing wrong?

What am I doing wrong?

Not reading the instructions and then following them!

Mark

Thank you for your helpful suggestion.

"Each section below is designed to be copied and pasted out into the file name of the title header (watch out if there's word wrap). To run the example code, create a "Thermistor4c" subdirectory inside your sketch directory and copy in the three files. The example code prints out a lot and is recommended for initial testing and calibration. "

Gee, that's what I did, but, as explained, it doesn't compile. I solved one error, changing WProgram.h to Arduino.h, so I don't get a file not found error.

The error message I get refers to setup and loop not being defined. I presume something is not quite right with the changeover from WProgram to Arduino.

BTW, I did change all the file permissions to 777, as suggested elsewhere. No luck.

As you are still not getting it I'll repeat my self

Not reading the instructions and then following them!

Mark

The error message I get refers to setup and loop not being defined. I presume something is not quite right with the changeover from WProgram to Arduino.

No, it means that the program that you are trying to compile in the Arduino IDE does not have a setup() or loop() function.

As pointed out above, you merely need to follow the instructions.
I just did exactly that, and the code compiled fine at the first attempt. (After changing the include from WProgram.h to Arduino.h.)

See the attached (zipped) folder below.

Thermistor4c.zip (10.3 KB)

Well, the attached zip does contain an ino file that compiles. Thank you for it. I still need to determine why the initial construction of the program did not work for me, but I am able to move on to my real application- a controller for my home brewery.

johnzbesko:
I still need to determine why the initial construction of the program did not work for me

We can only guess.
If you really want to know, you could post your complete *.ino, *.cpp and *.h files, and we could see what's going wrong. (Please ensure that you post them between code tags, and not inline. Code tags are the </> button in the "Reply" window.)

All I did was copy the text from the linked example and pasted it into the appropriately named files, then in "Thermistor4.h", changed "#include <WProgram.h>" to "#include <Arduino.h>".
It compiled fine at that stage.