Eclipse - Build output is parsed incorrectly

tuskiomi
Posts: 22
Joined: Mon Aug 28, 2017 8:21 pm

Eclipse - Build output is parsed incorrectly

Postby tuskiomi » Tue Dec 18, 2018 11:14 pm

Hello, I'm trying to build using eclipse C++ in Debian, and my output is not being parsed correctly.
In the end of the compilation, the console will always output
Build Failed. 130 errors, 1 warnings. (took 21s.459ms)
You can see the full output here: https://pastebin.com/ZWXijPPw

As you can see, it seems my build output parser is set correctly:
Image

The only thing that raises flags in my eyes is that it seems to be missing many "cygpath"s when it builds.
I'm not sure what that means.

ESP_Angus
Posts: 1649
Joined: Sun May 08, 2016 4:11 am

Re: Eclipse - Build output is parsed incorrectly

Postby ESP_Angus » Tue Dec 18, 2018 11:45 pm

Hi tuskiomi,

The cygpath message is a known issue on master branch, it should be fixed if you pull the latest master:
https://github.com/espressif/esp-idf/issues/2839

(Although I don't think it's the cause of any build problems, it's just unnecessary messages in the log.)

There are some legitimate compiler errors in the output as well (found by searching for "error:"):
In file included from /home/brice/esp/hello_world/main/hello_world_main.c:23:0:
/home/brice/esp/hello_world/main/NetACP/AccessPoint.h:11:1: error: unknown type name 'class'
class AccessPoint {
(This is the first one, it keeps going from here down.)

It looks like you've included a C++ header file from a C file. You'll need to use a .cpp file to include C++ headers, the C compiler is used for .c files.

Probably this header and these lines will be underlined with red squiggles in the Eclipse editor as well, after the build finishes.

tuskiomi
Posts: 22
Joined: Mon Aug 28, 2017 8:21 pm

Re: Eclipse - Build output is parsed incorrectly

Postby tuskiomi » Wed Dec 19, 2018 12:10 am

The only thing I need to do to swap the project from c to c++ is to change the extension from .c to .cpp?

tuskiomi
Posts: 22
Joined: Mon Aug 28, 2017 8:21 pm

Re: Eclipse - Build output is parsed incorrectly

Postby tuskiomi » Wed Dec 19, 2018 12:57 am

Well, that reduced the number of errors. Using the vanilla Hello-world.c, and changing the extension to .cpp, I get:
https://pastebin.com/rw1evCc6

it still gives me an error, and it seems very superfluous:
collect2: error: ld returned 1 exit status
make: *** [/home/brice/esp/esp-idf//make/project.mk:458: /home/brice/esp/hello_world/build/hello-world.elf] Error 1

18:44:49 Build Failed. 2 errors, 0 warnings. (took 7s.548ms)

ESP_Angus
Posts: 1649
Joined: Sun May 08, 2016 4:11 am

Re: Eclipse - Build output is parsed incorrectly

Postby ESP_Angus » Wed Dec 19, 2018 3:29 am

C++ files have different symbol names, so you need to change the app_main() function in your code to extern "C" app_main() so it can be linked from C code.

tuskiomi
Posts: 22
Joined: Mon Aug 28, 2017 8:21 pm

Re: Eclipse - Build output is parsed incorrectly

Postby tuskiomi » Wed Dec 19, 2018 5:43 am

alright. Surrounding the app_main with an extern "C" {} block fixed it :)

Who is online

Users browsing this forum: Baidu [Spider] and 12 guests