luni64 / TeensyStep4

MIT License
17 stars 15 forks source link

Compiler error #3

Closed ddhille closed 2 years ago

ddhille commented 3 years ago

Just tried out TeensyStep4 with PIO. I'm a total beginner in C++ (sorry to bother you); I have no clue what is wrong here. Any idea? I know you're working on other projects ;)

main.cpp

#include "Arduino.h"
#include "teensystep4.h"

using namespace TS4;

Stepper s1(0, 2);

void setup()
{
  TS4::begin();

  s1.setMaxSpeed(10'000);
  s1.setAcceleration(50'000);

  s1.moveAbs(1000);
}

void loop()
{
  s1.moveRel(-500);
  delay(200);

  s1.moveRel(500);
  delay(200);
}

Build errors

.pio/build/teensy41/lib449/libTeensyStep4.a(teensystep4.cpp.o): In function `TS4::begin(bool)':
teensystep4.cpp:(.text._ZN3TS45beginEb+0x24): undefined reference to `TS4::TimerFactory::attachModule(TS4::ITimerModule*)'

.pio/build/teensy41/lib449/libTeensyStep4.a(stepperbase.cpp.o): In function `std::_Function_handler<void (), TS4::StepperBase::startMoveTo(long, long, unsigned long, unsigned long)::{lambda()#1}>::_M_invoke(std::_Any_data const&)':
stepperbase.cpp:(.text._ZNSt17_Function_handlerIFvvEZN3TS411StepperBase11startMoveToEllmmEUlvE_E9_M_invokeERKSt9_Any_data+0x2e): undefined reference to `TS4::TimerFactory::returnTimer(TS4::ITimer*)'

.pio/build/teensy41/lib449/libTeensyStep4.a(stepperbase.cpp.o): In function `TS4::StepperBase::startMoveTo(long, long, unsigned long, unsigned long)':
stepperbase.cpp:(.text._ZN3TS411StepperBase11startMoveToEllmm+0xba): undefined reference to `TS4::TimerFactory::makeTimer()'
CloudHead84 commented 2 years ago

move the timer files in the subfolders to the project folder and it works. you will have to modify some #include lines

luni64 commented 2 years ago

@CloudHead84: is this a PIO thing or do I need to fix something?

luni64 commented 2 years ago

@ddhille: Sorry, looks like I didn't see your original issue from September last year

vp8181 commented 2 years ago

@CloudHead84 @luni64 downloaded the main file but arduino ide gives error of - (Specified folder/zip file does not contain a valid library) Later when i manually placed that file in my libraries folder the ide gave error- (Invalid library found in C:\Users\Vaibhav Pandey\OneDrive\Documents\Arduino\libraries\TeensyStep4: no headers files (.h) found in C:\Users\Vaibhav Pandey\OneDrive\Documents\Arduino\libraries\TeensyStep4)