Visual Studio Ide for Arduino
https://www.visualmicro.com/forums/YaBB.pl
>> >> Intellisense: 209 errors from external headers
https://www.visualmicro.com/forums/YaBB.pl?num=1429724706

Message started by fean on Apr 22nd, 2015 at 6:45pm

Title: Intellisense: 209 errors from external headers
Post by fean on Apr 22nd, 2015 at 6:45pm
Hi,

I'm trying to compile my pretty simple .ino file and all of a sudden I get like 209 header errors.
All from the following files:

[list bull-blackball]
  • wcharacter.h
  • stdlib.h
  • string.h
  • math.h
  • pgmspace.h
  • arduino.h
  • ctype.h
  • wstring.h


    Almost all of the errors are CS2059, CS2061, CS2054, CS2084.

    Also before these errors occurred I was having trouble with creating an .elf file or something. Because I can't re-generate the problem at the moment that's all I know about that.

    This is my .ino file:


    Code (c++):
    EventContainer* events;
    uint8_t ledStatus = 0;

    typedef struct {
         uint8_t status;
    } ledEventArgs;

    void setup()
    {
         // setup events
         container_create(events);

         // Create led event
         container_create_event(events, "LedEvent", 0);

         // Setup event handler
         container_add_listener(events, "LedEvent", handleLed);

         //init onboard led
         pinMode(13, OUTPUT);
    }

    void loop()
    {
         // Invert ledStatus
         ledStatus = ledStatus == 1 ? 0 : 1;

         // Create event arguments
         ledEventArgs* args;
         args->status = ledStatus;

         // Send event
         event_send(container_get(events, "LedEvent"), (void*)args);

         // Delay thread for 500 msec
         delay(500);
    }

    void handleLed(void *on) {
         // Write received status to onboard led
         digitalWrite(13, ((ledEventArgs*)on)->status);
    }

  • Title: Re: 209 errors from external headers
    Post by Visual Micro on Apr 22nd, 2015 at 6:59pm
    Three things

    1) Please switch on tools>options>visual micro>"Show build properties" and "Verbose". The email the output to info [at] visualmicro.com because it looks like your config is wrong.

    2) The code does not look valid for Arduino. Normally your own declarations would need to go in a separate header.

    3) Please state the path to the arduino.exe and the path you have entered in the Visual Micro locations config and which Visual Micro/Arduino app you selected? 1.6/1.0.x and which board you are using.

    In the Arduino Ide you code produces these errors

    [code]sketch_apr22a.ino:1:1: error: 'EventContainer' does not name a type
    sketch_apr22a.ino: In function 'void setup()':
    sketch_apr22a.ino:11:19: error: 'events' was not declared in this scope
    sketch_apr22a.ino:11:25: error: 'container_create' was not declared in this scope
    sketch_apr22a.ino:14:46: error: 'container_create_event' was not declared in this scope
    sketch_apr22a.ino:17:54: error: 'container_add_listener' was not declared in this scope
    sketch_apr22a.ino: In function 'void loop()':
    sketch_apr22a.ino:33:27: error: 'events' was not declared in this scope
    sketch_apr22a.ino:33:45: error: 'container_get' was not declared in this scope
    sketch_apr22a.ino:33:59: error: 'event_send' was not declared in this scope
    Error compiling.[/code]

    Title: Re: 209 errors from external headers
    Post by fean on Apr 22nd, 2015 at 7:10pm
    I just created a new project and copied the already existing files to the new project. Now I have the old error back:

    [code]
    Compiling 'Eind_Project' for 'Arduino Uno'
    Build folder: file:///C:/Users/Admin/AppData/Local/V.Micro/Arduino/Builds/Eind_Project/uno
    Summary: Header=1 Prototypes=4 Imports=0
    Additional Defines:
    Architecture Tools: C:\Program Files (x86)\Arduino/hardware/tools/avr/bin/
    GCC: 4.8.1
    Sketchbook: file:///C:/Users/Admin/Documents/Arduino
    Core Include Paths
    Include Path 'C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino'
    Include Path 'C:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard'
    "C:\Program Files (x86)\Arduino/hardware/tools/avr/bin/avr-gcc" -c -g -Os -w -ffunction-sections -fdata-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=161 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I"C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" -I"C:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "C:\Users\Admin\AppData\Local\V.Micro\Arduino\Builds\Eind_Project\uno\Event.c" -o "C:\Users\Admin\AppData\Local\V.Micro\Arduino\Builds\Eind_Project\uno\Event.c.o"
    "C:\Program Files (x86)\Arduino/hardware/tools/avr/bin/avr-gcc" -c -g -Os -w -ffunction-sections -fdata-sections -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=161 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I"C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" -I"C:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "C:\Users\Admin\AppData\Local\V.Micro\Arduino\Builds\Eind_Project\uno\EventContainer.c" -o "C:\Users\Admin\AppData\Local\V.Micro\Arduino\Builds\Eind_Project\uno\EventContainer.c.o"
    "C:\Program Files (x86)\Arduino/hardware/tools/avr/bin/avr-g++" -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=161 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I"C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" -I"C:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "C:\Users\Admin\AppData\Local\V.Micro\Arduino\Builds\Eind_Project\uno\Eind_Project.cpp" -o "C:\Users\Admin\AppData\Local\V.Micro\Arduino\Builds\Eind_Project\uno\Eind_Project.cpp.o"
    Build Core Paths: C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino
    "C:\Program Files (x86)\Arduino/hardware/tools/avr/bin/avr-gcc" -w -Os -Wl,--gc-sections -mmcu=atmega328p -o "C:\Users\Admin\AppData\Local\V.Micro\Arduino\Builds\Eind_Project\uno/Eind_Project.elf" "C:\Users\Admin\AppData\Local\V.Micro\Arduino\Builds\Eind_Project\uno\Event.c.o" "C:\Users\Admin\AppData\Local\V.Micro\Arduino\Builds\Eind_Project\uno\EventContainer.c.o" "C:\Users\Admin\AppData\Local\V.Micro\Arduino\Builds\Eind_Project\uno\Eind_Project.cpp.o" "C:\Users\Admin\AppData\Local\V.Micro\Arduino\Builds\Eind_Project\uno/core.a" "-LC:\Users\Admin\AppData\Local\V.Micro\Arduino\Builds\Eind_Project\uno" -lm
    Eind_Project.cpp.o:In function `setup'
    Eind_Project.cpp.o:In function `loop'
    collect2.exe*:error: ld returned 1 exit status
    Error creating .elf
    [/code]

    Also I'm compiling for the Arduino 1.6.1 SDK.

    Title: Re: 209 errors from external headers
    Post by Visual Micro on Apr 22nd, 2015 at 7:18pm
    Yes this will happen because you config seems wrong as I said in point 1) of my previous message. This will be easily solved but I need answers. Questions again....

    1) Please switch on tools>options>visual micro>"Show build properties" and "Verbose". The email the output to info [at] visualmicro.com because it looks like your config is wrong.

    2) Please state the path to the arduino.exe and the path you have entered in the Visual Micro locations config and which Visual Micro/Arduino app you selected? 1.6/1.0.x and which board you are using.

    Thanks

    Title: Re: 209 errors from external headers
    Post by fean on Apr 22nd, 2015 at 10:54pm
    Dear Tim,

    Hereby the requested details.

    The path to arduino.exe: C:\Program Files (x86)\Arduino\arduino.exe
    The path I entered in visual micro: C:\Program Files (x86)\Arduino

    I'm using a Arduino Uno board with Arduino SDK version 1.6.1 and visual micro version 1.6.1.

    This is what's being produced with the settings you suggested:

    http://pastebin.com/izBu8mET I had to put it on pastebin because it exceeded the 8000 characters quota for board messages.

    Title: Intellisense: Re: 209 errors from external headers
    Post by Visual Micro on Apr 22nd, 2015 at 11:08pm
    Okay thanks for all the info (except the visual micro version which is in tools>options)

    I think I have all the info now anyway.

    We have two things:-

    1)

    You have verbose mode switched on and we see two errors at the end of the compile along with a note to say the compile failed. The two errors lines don't mean much but show you have an error in your code. If you switch "verbose mode" and "show build props" off now we have finished the test life will be easier for you.

    Every so often you might get a couple of weak errors displayed by Visual Micro in that case you can check the compile using the Arduino ide. The source is compatible between the two ide's (but we will look at fixing the detail in this type of error report for the next release because it's a really cr.p one for vm. I think the problem is the location of the wrong code. Top of the file is where stuff is inserted into a temp copy for an Arduino compile so working out line numbers in relation to the real code gets trickier).

    In this case I checked your code for, you as you can read in my earlier post, and your code is invalid.

    In the Arduino Ide you code produces these errors:-

    [code]sketch_apr22a.ino:1:1: error: 'EventContainer' does not name a type
    sketch_apr22a.ino: In function 'void setup()':
    sketch_apr22a.ino:11:19: error: 'events' was not declared in this scope
    sketch_apr22a.ino:11:25: error: 'container_create' was not declared in this scope
    sketch_apr22a.ino:14:46: error: 'container_create_event' was not declared in this scope
    sketch_apr22a.ino:17:54: error: 'container_add_listener' was not declared in this scope
    sketch_apr22a.ino: In function 'void loop()':
    sketch_apr22a.ino:33:27: error: 'events' was not declared in this scope
    sketch_apr22a.ino:33:45: error: 'container_get' was not declared in this scope
    sketch_apr22a.ino:33:59: error: 'event_send' was not declared in this scope
    Error compiling.[/code]

    2) 209 Errors

    I re-read your first post and now realize that you were talking about intellisense error console errors. That is a visual studio C++ window that does not reflect the true Arduino compilation result. The intellisense and compile are two different things for Visual Micro due to the fact that Visual Studio does not know what to do with multiple .ino files.

    To check the true result you have to compile because that is when Visual Micro can have full control and ensure the project is glued together correctly. Having said that normally I only expect to see 10 errors at most in the VS Error Window.

    For now I suggest you close the VS Error Window and get your Arduino code fixed and the compile working.

    Then revisit this post and we can see what's going on with your intellisense. In that case I will need to know which version of Visual Studio you are running.

    This is intellisense and can be ignored for now:-


    Quote:
    Almost all of the errors are CS2059, CS2061, CS2054, CS2084.


    Hope this makes sense

    Thanks again for the info

    Title: Re: Intellisense: 209 errors from external headers
    Post by fean on Apr 22nd, 2015 at 11:46pm
    Dear Tim,

    Thank you for your thorough research and support!
    The thing is that the compile errors from the Arduino IDE I'd expect because the header and c files containing the code that's being referenced I didn't post on the board.

    Link to EventContainer.h:
    http://pastebin.com/UJrGS51i

    Link to Event.h:
    http://pastebin.com/kJD2itDA

    I also put the struct that I had first put before setup() into it's own header file.
    Am I doing something wrong? I added the header files to the 'Header files' folder and the c files into the 'Source folder'. It still says precisely the same.

    Thanks!

    Title: Re: Intellisense: 209 errors from external headers
    Post by Visual Micro on Apr 23rd, 2015 at 12:01am
    No problem.

    So does it compile in the arduino ide?

    Thanks

    Title: Re: Intellisense: 209 errors from external headers
    Post by fean on Apr 23rd, 2015 at 7:47pm
    So I tried running it in the Arduino IDE, but it looks like the functions can't be found. It looks like the structs in the header files can be found but the function not.

    This is the IDE output:
    [code]

    Eind_Project.cpp.o: In function `setup':
    C:\Program Files (x86)\Arduino/Eind_Project.ino:11: undefined reference to `container_create(EventContainer*)'
    C:\Program Files (x86)\Arduino/Eind_Project.ino:14: undefined reference to `container_create_event(EventContainer*, char*, unsigned char)'
    C:\Program Files (x86)\Arduino/Eind_Project.ino:17: undefined reference to `container_add_listener(EventContainer*, char*, void (*)(void*))'
    Eind_Project.cpp.o: In function `loop':
    C:\Program Files (x86)\Arduino/Eind_Project.ino:33: undefined reference to `container_get(EventContainer*, char*)'
    C:\Program Files (x86)\Arduino/Eind_Project.ino:33: undefined reference to `event_send(Event*, void*)'
    collect2.exe: error: ld returned 1 exit status
    Error compiling.

    [/code]

    Title: Re: Intellisense: 209 errors from external headers
    Post by Visual Micro on Apr 23rd, 2015 at 7:58pm
    Snap matches my output posted earlier  :)

    Title: Re: Intellisense: 209 errors from external headers
    Post by fean on Apr 23rd, 2015 at 8:01pm
    Well it's not a 100% match the first line is different:

    [code]
    sketch_apr22a.ino:1:1: error: 'EventContainer' does not name a type
    [/code]

    That's why I thought the header files could be resolved but the function names not.

    Title: Re: Intellisense: 209 errors from external headers
    Post by Visual Micro on Apr 23rd, 2015 at 8:06pm
    Looks the same to me except for the sketch nameĀ  :)

    Is your .h header in the sketch/program folder?
    Have you #included it in your .ino code?

    Thanks

    Title: Re: Intellisense: 209 errors from external headers
    Post by fean on Apr 23rd, 2015 at 8:10pm
    The header files are in the sketch folder next to the .ino file. Is that the right location for them? I also have included them in the main .ino file.

    Title: Re: Intellisense: 209 errors from external headers
    Post by Visual Micro on Apr 23rd, 2015 at 8:11pm
    Maybe not external or public then?

    Please place for help is the arduino.cc forum. This one specializes in the free plugin and debugger. The Arduino is full of Arduino experts.


    Title: Re: Intellisense: 209 errors from external headers
    Post by fean on Apr 23rd, 2015 at 8:40pm
    I have asked my question on the arduino.cc board. Thanks for your help!

    Visual Studio Ide for Arduino » Powered by YaBB 2.5.2!
    YaBB Forum Software © 2000-2019. All Rights Reserved.