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

pio init makes QtCreator not understand Arduino C++ properly #1323

Closed
hongquan opened this Issue Jan 31, 2018 · 4 comments

Comments

Projects
None yet
3 participants
@hongquan

hongquan commented Jan 31, 2018

What kind of issue is this?

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

Configuration

Operating system: Ubuntu 17.10

PlatformIO Version (platformio --version): 3.5.2a5

Description of problem

Steps to Reproduce

  1. Have an Arduino project
  2. Run pio init --ide qtcreator --board esp07
  3. Open the .ino file in QtCreator

Actual Results

.pro file contains DEFINES lines like this:

DEFINES += ARDUINO=10600
DEFINES += LWIP_OPEN_SRC

and QtCreator shows some errors in .ino: "expected a declaration".

Expected Results

There should be no "expected a declaration" error.

If problems with PlatformIO Build System:

The content of platformio.ini:

[env:esp07]
platform = espressif8266
board = esp07
framework = arduino

Source file to reproduce issue:

Insert here...

Additional info

This is the result of attempt to fix #1299.

Before the fix (with the trailing "#" being stripped):

pio-old

After the fix:

pio_v3 5 2a5

I used to proposed a fix (#1290), in which I keep the quote (") and removed # from DEFINES, but unfortunately, it was rejected.

@ivankravets

This comment has been minimized.

Member

ivankravets commented Feb 5, 2018

Please re-test with pio upgrade --dev and pio init

@hongquan

This comment has been minimized.

hongquan commented Feb 6, 2018

In 53afdc5, I see that you are doing:

% tokens = define.split("##", 1)
DEFINES += "{{tokens[0].strip()}}"

but what happen if some lines use single #?

@ivankravets

This comment has been minimized.

Member

ivankravets commented Feb 6, 2018

The problem was caused by internal macros of GCC compiler. We've started to add them recently. There is no # in macro, see https://stackoverflow.com/questions/21891784/what-does-mean-in-c

@hongquan

This comment has been minimized.

hongquan commented Feb 6, 2018

Thank you.

ivankravets added a commit that referenced this issue Mar 13, 2018

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