error compiling on teensyduino for teensy 3

Status
Not open for further replies.

nekidfrog

Active member
I'm building a class and header file in the same directory as my project file. If I move the .h and .cpp to it's own library directory, it compiles fine. If I leave it in my project directory so that I can edit it easily in the arduino ide as well as my project... I get this

C:\Users\ddelcambre\Downloads\arduino-1.0.3\hardware\teensy\cores\teensy3/main.cpp:23: undefined reference to `setup'
C:\Users\ddelcambre\Downloads\arduino-1.0.3\hardware\teensy\cores\teensy3/main.cpp:25: undefined reference to `loop'

not sure why the IDE does not like having my .h and .cpp in the project directory...
 
teensy 3.0
arduino ide 1.0.3
teensyduino 1.12

code does NOT matter but you can replicate it with this. 3 files in same directory test.ino test.cpp and test.h

test.ino
Code:
#include "test.h"

void setup{
}

void loop{
}

in test.cpp
Code:
#include "test.h"

test.h is blank.

main.cpp.o: In function `main':
C:\Users\ddelcambre\Downloads\arduino-1.0.3\hardware\teensy\cores\teensy3/main.cpp:23: undefined reference to `setup'
C:\Users\ddelcambre\Downloads\arduino-1.0.3\hardware\teensy\cores\teensy3/main.cpp:25: undefined reference to `loop'
collect2.exe: error: ld returned 1 exit status

this is the exact error I get. If I move test.cpp and test.h to a test folder in libraries this will work no problem. however if those files are in the project directory it does not compile. The only reason I have them inside the project folder, is for editing those files easily inside the arduino ide. Otherwise I have to open notepad separately to edit those files. And since those are being developed as a library for my new project it would be nice to be able to edit them inside the ide along with the project code.
 
Last edited:
Status
Not open for further replies.
Back
Top