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
Normal Topic How to include header files? (Read 11394 times)
TDALP
Newbies
*
Offline


Posts: 3
Joined: Oct 23rd, 2013
How to include header files?
Oct 23rd, 2013 at 12:20pm
Print Post  
I want to include some header file, i have created them with matlab/simulink.

if i add them with visualstuido feature "add existing file" and write #include "test.h"  i get the message error: unable to open source.

i have tryed to copy the files in the project ordner and add them than, but i get all the time the same error -.-

I use :
Microsoft Visual Studio 2010
Version 10.0.30319.1 RTMReL

the last stabel version of the Visual Micro Plugin (Wed Sep 11, 2013 at 9:00 AM)

and Arduino IDE 1.5.2 beta
« Last Edit: Oct 23rd, 2013 at 12:23pm by TDALP »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: How to include header files?
Reply #1 - Oct 23rd, 2013 at 1:25pm
Print Post  
Hello,

The plugin forces the Arduino rules to be in force. This means that we can always compile our Visual Studio projects in either Visual Studio or the Arduino Ide. It also means that you can refer to arduino.cc for documentation or the arduino forum for help.

The rules in this case are that .h/.cpp files must reside directly in the sketch folder or as an Arduino library. 

If you place the .h in the sketch folder and #include "myfile.h" it should work fine? You have said this doesn't work which suggests that VS is failing with a normal C++ include. We use C++ files for Arduino. What if you close VS and re-open, maybe it got confused (see RTM note below)

Thanks

note: A word of warning about the 2010 RTM version. It was full of bugs, SP1 is the only good version of VS 2010. Atmel Studio is based on 2010 and is free, so if you hit any problems then I recommend using Atmel for your Arduino dev. Visual Micro works the same in Atmel.
« Last Edit: Oct 23rd, 2013 at 1:26pm by Tim@Visual Micro »  
Back to top
IP Logged
 
TDALP
Newbies
*
Offline


Posts: 3
Joined: Oct 23rd, 2013
Re: How to include header files?
Reply #2 - Oct 23rd, 2013 at 2:11pm
Print Post  
Thank you for the fast help. I think i can work now Smiley
  
Back to top
 
IP Logged
 
TDALP
Newbies
*
Offline


Posts: 3
Joined: Oct 23rd, 2013
Re: How to include header files?
Reply #3 - Oct 24th, 2013 at 8:16am
Print Post  
Now i get another error message the #include works. 
Quote:
Compiling debug version of 'eslebt' for 'Arduino Due (Programming Port)'
eslebt.cpp.o : : In function `setup':
eslebt.ino : undefined reference to `Chart_initialize()'


the code lools like this:
Code
Select All
#include "sfnc_Heizung_mit_Temp.h"

void setup()
{
  /* add setup code here */
	sfnc_Heizung_mit_Temp_initialize();
	pinMode(52,OUTPUT);
	pinMode(50,OUTPUT);
	pinMode(48,OUTPUT);
	pinMode(0,INPUT);


}

void loop()
{
/* add main program code here */
	sfnc_Heizung_mit_Temp_step();
	delay(1);

	digitalWrite(52,sfnc_Heizung_mit_Temp_Y.Out1);
	digitalWrite(50,sfnc_Heizung_mit_Temp_Y.Out2); 



i have no idea, what i make wrong.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: How to include header files?
Reply #4 - Oct 24th, 2013 at 6:23pm
Print Post  
Hi,

Does your cpp code reference a library? If so you need to include the library in your main sketch .ino code.

Use the menu item "project>add/import sketch library" to import a library it is easier.

  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint