Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » Build with AVR C compiler(Build compiler error)
Build with AVR C compiler [message #1764574] Wed, 31 May 2017 07:44 Go to next message
Eclipse UserFriend
Having installed AVR plugin witah all the necessary plugins and compilers, after trying to build first project I get the following error message:
--------------------------------------
make all
Building file: ../main.c
Invoking: AVR Compiler
avr-gcc -Wall -g2 -gstabs -O0 -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -std=gnu99 -funsigned-char -funsigned-bitfields -mmcu=atmega128 -DF_CPU=1000000UL -MMD -MP -MF"main.d" -MT"main.o" -c -o "main.o" "../main.c"
In file included from ../main.c:7:0:
/home/kurt/NiboRobolib/Nibo/libraries/NIBO2/NIBO2.h:45:1: error: unknown type name 'class'
class NIBO2Class {
subdir.mk:18: recipe for target 'main.o' failed
^
/home/kurt/NiboRobolib/Nibo/libraries/NIBO2/NIBO2.h:45:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
class NIBO2Class {
^
/home/kurt/NiboRobolib/Nibo/libraries/NIBO2/NIBO2.h:64:8: error: unknown type name 'NIBO2Class'
extern NIBO2Class NIBO2;
^
/home/kurt/NiboRobolib/Nibo/libraries/NIBO2/NIBO2.h:70:1: error: unknown type name 'class'
class EnginePartClass {
^
/home/kurt/NiboRobolib/Nibo/libraries/NIBO2/NIBO2.h:70:23: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
class EnginePartClass {
^
/home/kurt/NiboRobolib/Nibo/libraries/NIBO2/NIBO2.h:81:1: error: unknown type name 'class'
class EngineClass {
^
/home/kurt/NiboRobolib/Nibo/libraries/NIBO2/NIBO2.h:81:19: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
class EngineClass {
^
/home/kurt/NiboRobolib/Nibo/libraries/NIBO2/NIBO2.h:97:8: error: unknown type name 'EngineClass'
extern EngineClass Engine;
^
------------------------ etc ------------------------------------------
included NIBO2.h file looks like: see attachement:

any help is appreciated.

Thanks a lot.
  • Attachment: NIBO2.h
    (Size: 3.11KB, Downloaded 221 times)
Re: Build with AVR C compiler [message #1764611 is a reply to message #1764574] Wed, 31 May 2017 14:51 Go to previous messageGo to next message
Eclipse UserFriend
Perhaps this is related: http://avr-eclipse.sourceforge.net/wiki/index.php/Support
Re: Build with AVR C compiler [message #1764618 is a reply to message #1764574] Wed, 31 May 2017 15:34 Go to previous messageGo to next message
Eclipse UserFriend
It seems that you're attempting to compile C++ with a plain C compiler.
Re: Build with AVR C compiler [message #1764647 is a reply to message #1764618] Thu, 01 June 2017 03:28 Go to previous messageGo to next message
Eclipse UserFriend
This is also my guess, but how can I ensure the C++ compiler is used? I have installed the C/C++ environment, but cannot find, where to specify the C++ compiler to be used.
Re: Build with AVR C compiler [message #1764651 is a reply to message #1764647] Thu, 01 June 2017 03:45 Go to previous messageGo to next message
Eclipse UserFriend
If this involves C/C++ it's probably better posted on the CDT forum.
Re: Build with AVR C compiler [message #1764783 is a reply to message #1764651] Fri, 02 June 2017 05:12 Go to previous messageGo to next message
Eclipse UserFriend
Can you create a new C++ project instead of a C one? Does AVR provide C++ projects (not all embedded tools suppliers do).
Re: Build with AVR C compiler [message #1764817 is a reply to message #1764783] Fri, 02 June 2017 08:15 Go to previous messageGo to next message
Eclipse UserFriend
The name of the file you are compiling is main.c
GCC will try to compile it as a C file if avr-gcc is anything like run-of-the-mill gcc.
NIBO2.h has C++ code in it so it seems C++ is wanted.

Try changing main.c to main.cpp
There is a run-of-the-mill gcc option to specify the language
Try -x c++ if you want to the name to be main.c

Re: Build with AVR C compiler [message #1764836 is a reply to message #1764817] Fri, 02 June 2017 10:25 Go to previous message
Eclipse UserFriend
Thank you very much for the tip.
I changed the filename from main.c to main.cpp and now it is working as expected.
Previous Topic:Eclipse don't start on MacOSX
Next Topic:[ESP-IDF] No cross-gcc option
Goto Forum:
  


Current Time: Mon Mar 17 21:49:37 EDT 2025

Powered by FUDForum. Page generated in 0.03744 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top