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

including mbcontroller.h from a cpp file breaks compilation (IDFGH-14554) #91

Open
3 tasks done
attilabody opened this issue Jan 31, 2025 · 5 comments
Open
3 tasks done
Assignees

Comments

@attilabody
Copy link

Checklist

  • Checked the issue tracker for similar issues to ensure this is not a duplicate
  • Read the documentation to confirm the issue is not addressed there and your configuration is set correctly
  • Tested with the latest version to ensure the issue hasn't been fixed

How often does this bug occurs?

always

Expected behavior

Including mbcontroller.h from a cpp file should not break compilation

Actual behavior (suspected bug)

Including mbcontroller.h from a cpp file breaks compilation

Error logs or terminal output

In file included from /home/abody/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/xtensa-esp-elf/include/c++/14.2.0/bits/atomic_base.h:36,
                 from /home/abody/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/xtensa-esp-elf/include/c++/14.2.0/atomic:50,
                 from /home/abody/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/xtensa-esp-elf/include/c++/14.2.0/stdatomic.h:36,
                 from /mnt/userdata_ssd/abody/work/heattransformers/RemoteMockHeatpump/managed_components/espressif__esp-modbus/modbus/mb_objects/include/mb_port_types.h:8,
                 from /mnt/userdata_ssd/abody/work/heattransformers/RemoteMockHeatpump/managed_components/espressif__esp-modbus/modbus/mb_ports/common/port_common.h:19,
                 from /mnt/userdata_ssd/abody/work/heattransformers/RemoteMockHeatpump/managed_components/espressif__esp-modbus/modbus/mb_controller/common/include/esp_modbus_common.h:20,
                 from /mnt/userdata_ssd/abody/work/heattransformers/RemoteMockHeatpump/managed_components/espressif__esp-modbus/modbus/mb_controller/common/include/esp_modbus_master.h:12,
                 from /mnt/userdata_ssd/abody/work/heattransformers/RemoteMockHeatpump/managed_components/espressif__esp-modbus/modbus/mb_controller/common/include/mbcontroller.h:17,
                 from /mnt/userdata_ssd/abody/work/heattransformers/RemoteMockHeatpump/main/remote_mock_heatpump_main.cpp:18:
/home/abody/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/xtensa-esp-elf/include/c++/14.2.0/new:195:3: error: template with C linkage
  195 |   template<typename _Tp>
      |   ^~~~~~~~
...
(hundreds of lines of errors follow)

Steps to reproduce the behavior

  1. activate esp-idf (tested with 5.3.2 and 5.4)
  2. create a new project from the Hello World example
  3. add the esp-modbus as a dependency
  4. rename the main c file to cpp
  5. adjust Cmake accordingly
  6. add "mbcontroller.h" to the includes
  7. idf. py build

optional:
8. rename the main cpp file back to c
9. the build succeeds

Project release version

^2.0.1~1

System architecture

Intel/AMD 64-bit (modern PC, older Mac)

Operating system

Linux

Operating system version

Arch

Shell

Bash

Additional context

No response

@github-actions github-actions bot changed the title including mbcontroller.h from a cpp file breaks compilation including mbcontroller.h from a cpp file breaks compilation (IDFGH-14554) Jan 31, 2025
@fink-at-trmc-dk
Copy link

Excactly the same problem. Cannot compile as C++...

@alisitsyn
Copy link
Collaborator

Hi @fink-at-trmc-dk, @attilabody,

Thank you for reporting. I need to complete something and will take a look to it ASAP.

@alisitsyn
Copy link
Collaborator

alisitsyn commented Feb 5, 2025

The preliminary solution is provided in the PR above. Please help to check this in your local component. This will be fixed in v2.0.2 as soon as possible. Thanks.

@fink-at-trmc-dk
Copy link

fink-at-trmc-dk commented Feb 9, 2025

IT seems to compile on my setup now. Now I just need to migrate from 1.x to 2.x. But the compilation åroblems from before seems to be gone....

@alisitsyn
Copy link
Collaborator

alisitsyn commented Feb 10, 2025

@fink-at-trmc-dk,

Thank you for your report. I will make some updates to this PR and will merge this as soon as possible.

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

No branches or pull requests

4 participants