New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#includes in included files are not recognized #189

Closed
cqql opened this Issue May 2, 2015 · 6 comments

Comments

Projects
None yet
3 participants
@cqql

cqql commented May 2, 2015

Hi,
I wrote a wrapper for Servo.h

// In motor.h
#include <Servo.>

class Motor {...}
// In main.cpp
#include "motor.h"

When I run platformio run, it does not recognize the #include <Servo.h> directive and so the -I switch for it is missing, when platformio calls avr-g++. I tracked it down to this line, but do not know SCons, so I hope, that this is enough to fix it. The problem seems to be, that env.File is constructing an SCons.Node.FS.File object for the path "src/motor.h", but the File constructor manipulates this path to "scripts/src/motor.h", which does not exists. Then node.get_text_contents() returns "", which obviously does not include the #include directive.

@ivankravets

This comment has been minimized.

Member

ivankravets commented May 3, 2015

Is this a typo in this line #include <Servo.>? Try to replace it to #include <Servo.h>

@cqql

This comment has been minimized.

cqql commented May 3, 2015

No, sorry, that was just a typo on here. I created a minimal environment to provoke the bug.

Running platformio run there produces the following output

(.env)❯ platformio run
[Sun May  3 23:26:27 2015] Processing uno (targets: upload, platform: atmelavr, board: uno, framework: arduino)
-----------------------------------------------------------------------------
avr-g++ -o .pioenvs/uno/src/Motor.o -c -fno-exceptions -fno-threadsafe-statics -g -Os -Wall -ffunction-sections -fdata-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO_AVR_UNO -DARDUINO=10603 -DPLATFORMIO=010400 -I.pioenvs/uno/FrameworkArduino -I.pioenvs/uno/FrameworkArduinoVariant .pioenvs/uno/src/Motor.cpp
In file included from .pioenvs/uno/src/Motor.cpp:1:0:
.pioenvs/uno/src/Motor.h:1:19: fatal error: Servo.h: No such file or directory
#include <Servo.h>
^
compilation terminated.
scons: *** [.pioenvs/uno/src/Motor.o] Error 1

@ivankravets ivankravets added bug and removed help wanted labels May 3, 2015

@ivankravets ivankravets added this to the 1.5.0 milestone May 3, 2015

@ivankravets

This comment has been minimized.

Member

ivankravets commented May 3, 2015

@valeros Please re-test it. Thanks in advance!

@valeros valeros assigned ivankravets and unassigned valeros May 4, 2015

@ivankravets

This comment has been minimized.

Member

ivankravets commented May 4, 2015

@cqql Thanks for report. I've just reproduced it and will fix tomorrow.

@ivankravets

This comment has been minimized.

Member

ivankravets commented May 5, 2015

@cqql Please re-test it using PlatformIO Development Version.

Thanks in advance!

@cqql

This comment has been minimized.

cqql commented May 6, 2015

Now it works as expected.

Thanks a lot :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment