Skip to content
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

subfolder of lib mustn't be named *config* #1914

Closed
1 task
atsteich opened this issue Nov 7, 2018 · 11 comments
Closed
1 task

subfolder of lib mustn't be named *config* #1914

atsteich opened this issue Nov 7, 2018 · 11 comments
Labels
Milestone

Comments

@atsteich
Copy link

atsteich commented Nov 7, 2018

  • PlatformIO Core.
    If you’ve found a bug, please provide an information below.

You can erase any parts of this template not applicable to your Issue.


Configuration

Ubuntu 17.04 system:

3.6.2a2

I have the following folder structure, and everything is working fine.

|-- Projectfolder
    |-- include
        |-- README
    |-- lib
        |-- lib1
            |-- src
                |-- lib1.h
                |-- lib1.cpp
        |-- lib2
            |-- src
                |-- lib2.h
                |--  lib2.cpp
    |-- src
        |-- main.cpp
    |-- platformio.ini

code of lib1.h:
void func1();

code of lib1.cpp:

void func1(){ 
    //doanythinghere 
}

code of lib2.h:
void func2();

code of lib2.cpp:

#include <lib1.h>

void func2(){
    func1();
}

code of main.cpp

#include <lib2.h>

void setup(){
}

void loop(){
    func2();
}

BUT: As soon I am renaming

lib1 -> config
lib1.h -> config.h
lib1.cpp -> config.cpp

I get an Compile Error:
lib/lib2/src/lib2.cpp:4:11: error: 'func1' was not declared in this scope

If for any reason this is not a bug but a feature, it should be mentioned in the Readme, i spent almost a day on finding out that the problem is the name of the lib...

The content of platformio.ini:

[env:featheresp32]
platform = espressif32
board = featheresp32
framework = arduino
@ivankravets
Copy link
Member

Did you rename #include <lib1.h> in lib2.cpp:?

@atsteich
Copy link
Author

Did you rename #include <lib1.h> in lib2.cpp:?

Of course!

@ivankravets
Copy link
Member

Please provide archive with a simple project to reproduce this issue. Thanks!

@atsteich
Copy link
Author

you can find it on my github account: https://github.com/atsteich/pub

@atsteich
Copy link
Author

has anybody been able to reproduce?

@ivankravets
Copy link
Member

Sorry for delay. Please upgrade PIO Core to the latest dev version via pio upgrade --dev. Does it work now?

@ivankravets
Copy link
Member

The issue was linked with duplicated config.h in Arduino framework which was in the first order in CPPPATH. Nevertheless, this is a bug, user's custom includes, project includes, and library dependencies should go first in list for C Preprocessor.

@atsteich
Copy link
Author

after upgrading everything works as expected, thanks!

@ivankravets ivankravets added this to the 3.6.2 milestone Nov 19, 2018
ivankravets added a commit that referenced this issue Nov 24, 2018
* develop: (31 commits)
  Document "erase" target
  Docs: Grammar fixes
  Bump version to 3.6.2b5
  Improved IntelliSense for PlatformIO IDE for VSCode via passing extra compiler information for C/C++ Code Parser
  Bump version to 3.6.2b4
  LDF: Stop handling "define" and "undef" when condition fails; handle CPP files in "chain+" and "deep+" modes // Resolve #1930
  Bump version to 3.6.2b3
  Handle CWD when searching for a file // Resolve #1930
  Document in `library.json` how to pass flags to a global build environment
  Bump version to 3.6.2b2
  Fix an issue when Library Dependency Finder (LDF) finds spurious dependencies in ``chain+`` and ``deep+`` modes // Resolve #1930
  Fix an issue when Library Dependency Finder (LDF) does not handle project `src_filter ` // Resolve #1905
  Bump version to 3.6.2b1
  Prepend CPPATH of library dependencies instead of appending // Resolve #1914
  Bump version to 3.6.2a3
  Go over 8010-8100 TCP ports when shutting down PIO Home server
  Docs: Add support for OLIMEX ESP32-PRO
  Rename "System" to "Hardware" for board spec
  Add info about "EN" pin for ESP32 and debug probes
  Fix pinouts for oddWires IOT-Bus JTAG
  ...

# Conflicts:
#	platformio/__init__.py
#	platformio/managers/core.py
@nstiurca
Copy link

Sorry to resurrect an old issue, but it seems commit b22ca10 has broken my builds. I have a project where my platformio.ini has something like

[platformio]
include_dir = ./foo_lib
...

[env:...]
...
lib_deps =
  bar_lib
  ...

Prior to b22ca10, the build command would effectively end up with -I./foo_lib before -I./.piolibdeps/bar_lib/ which worked. After this patch, the order is flipped, which I guess was the intent?

Unfortunately I have a .h file with the same name in both foo_lib and bar_lib, and it would be very difficult to resolve the name conflict cleanly. I need the version in foo_lib, not in the thirdparty bar_lib for compiling my code.

I'm a bit confused because if anything, the changes that were made to close this issue seem like they would have ensured that whatever I specified with include_dir would have ended up first, but this does not seem to be the case. Regardless, how do I ensure that -I./foo_lib comes early in the build flags?

@ivankravets ivankravets reopened this Mar 23, 2019
@ivankravets ivankravets modified the milestones: 3.6.2, 3.6.6 Mar 23, 2019
ivankravets added a commit that referenced this issue Mar 23, 2019
@ivankravets
Copy link
Member

@nstiurca thank you so much for the report! Please re-test with pio upgrade --dev.

@nstiurca
Copy link

That fixed it for me, thanks for the quick turnaround!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants