Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 8 Replies) Intellisense: 209 errors from external headers (Read 14696 times)
fean
Newbies
*
Offline


Posts: 8
Joined: Apr 22nd, 2015
Intellisense: 209 errors from external headers
Apr 22nd, 2015 at 5:45pm
Print Post  
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:

  • 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++)
Select All
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);
}
 

« Last Edit: Apr 22nd, 2015 at 10:13pm by Tim@Visual Micro »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: 209 errors from external headers
Reply #1 - Apr 22nd, 2015 at 5:59pm
Print Post  
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
Select All
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. 

« Last Edit: Apr 22nd, 2015 at 10:15pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
fean
Newbies
*
Offline


Posts: 8
Joined: Apr 22nd, 2015
Re: 209 errors from external headers
Reply #2 - Apr 22nd, 2015 at 6:10pm
Print Post  
I just created a new project and copied the already existing files to the new project. Now I have the old error back:

Code
Select All
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:\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" iner.c" -o iner.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" ct.cpp" -o ct.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 ct.elf"  iner.c.o" ct.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
 



Also I'm compiling for the Arduino 1.6.1 SDK.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: 209 errors from external headers
Reply #3 - Apr 22nd, 2015 at 6:18pm
Print Post  
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
« Last Edit: Apr 22nd, 2015 at 6:18pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
fean
Newbies
*
Offline


Posts: 8
Joined: Apr 22nd, 2015
Re: 209 errors from external headers
Reply #4 - Apr 22nd, 2015 at 9:54pm
Print Post  
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.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Intellisense: Re: 209 errors from external headers
Reply #5 - Apr 22nd, 2015 at 10:08pm
Print Post  
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
Select All
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. 



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
« Last Edit: Apr 22nd, 2015 at 10:19pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
fean
Newbies
*
Offline


Posts: 8
Joined: Apr 22nd, 2015
Re: Intellisense: 209 errors from external headers
Reply #6 - Apr 22nd, 2015 at 10:46pm
Print Post  
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!
« Last Edit: Apr 22nd, 2015 at 10:48pm by fean »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Intellisense: 209 errors from external headers
Reply #7 - Apr 22nd, 2015 at 11:01pm
Print Post  
No problem.

So does it compile in the arduino ide?

Thanks
  
Back to top
WWW  
IP Logged
 
fean
Newbies
*
Offline


Posts: 8
Joined: Apr 22nd, 2015
Re: Intellisense: 209 errors from external headers
Reply #8 - Apr 23rd, 2015 at 6:47pm
Print Post  
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
Select All

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.

 

  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Intellisense: 209 errors from external headers
Reply #9 - Apr 23rd, 2015 at 6:58pm
Print Post  
Snap matches my output posted earlier  Smiley
  
Back to top
WWW  
IP Logged
 
fean
Newbies
*
Offline


Posts: 8
Joined: Apr 22nd, 2015
Re: Intellisense: 209 errors from external headers
Reply #10 - Apr 23rd, 2015 at 7:01pm
Print Post  
Well it's not a 100% match the first line is different:

Code
Select All
sketch_apr22a.ino:1:1: error: 'EventContainer' does not name a type
 



That's why I thought the header files could be resolved but the function names not.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Intellisense: 209 errors from external headers
Reply #11 - Apr 23rd, 2015 at 7:06pm
Print Post  
Looks the same to me except for the sketch nameĀ  Smiley

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

Thanks
« Last Edit: Apr 23rd, 2015 at 7:06pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
fean
Newbies
*
Offline


Posts: 8
Joined: Apr 22nd, 2015
Re: Intellisense: 209 errors from external headers
Reply #12 - Apr 23rd, 2015 at 7:10pm
Print Post  
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.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Intellisense: 209 errors from external headers
Reply #13 - Apr 23rd, 2015 at 7:11pm
Print Post  
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.

« Last Edit: Apr 23rd, 2015 at 7:12pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
fean
Newbies
*
Offline


Posts: 8
Joined: Apr 22nd, 2015
Re: Intellisense: 209 errors from external headers
Reply #14 - Apr 23rd, 2015 at 7:40pm
Print Post  
I have asked my question on the arduino.cc board. Thanks for your help!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint