Page 1 of 1

Eclipse - Build output is parsed incorrectly

Posted: Tue Dec 18, 2018 11:14 pm
by tuskiomi
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.

Re: Eclipse - Build output is parsed incorrectly

Posted: Tue Dec 18, 2018 11:45 pm
by ESP_Angus
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.

Re: Eclipse - Build output is parsed incorrectly

Posted: Wed Dec 19, 2018 12:10 am
by tuskiomi
The only thing I need to do to swap the project from c to c++ is to change the extension from .c to .cpp?

Re: Eclipse - Build output is parsed incorrectly

Posted: Wed Dec 19, 2018 12:57 am
by tuskiomi
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)

Re: Eclipse - Build output is parsed incorrectly

Posted: Wed Dec 19, 2018 3:29 am
by ESP_Angus
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.

Re: Eclipse - Build output is parsed incorrectly

Posted: Wed Dec 19, 2018 5:43 am
by tuskiomi
alright. Surrounding the app_main with an extern "C" {} block fixed it :)