ROBOTC.net forums
http://www.robotc.net/forums/

#include files
http://www.robotc.net/forums/viewtopic.php?f=63&t=11701
Page 1 of 1

Author:  ronaldle [ Thu Jul 09, 2015 9:31 am ]
Post subject:  #include files

I created a file named "standard.txt". I want to use the statement #include "standard.txt". I am getting a compiler error. Which directory should standard.txt reside in.

Thanks

Author:  mightor [ Thu Jul 09, 2015 1:04 pm ]
Post subject:  Re: #include files

What is the compile error you are seeing? Include files tend to have the .h extension, not .txt.

= Xander

Author:  ronaldle [ Thu Jul 09, 2015 5:34 pm ]
Post subject:  Re: #include files

Couldn't open '#include' file 'Ronstandard.h' is the error that I get.

I tried to place the file in RobotC includes directory but did not have access.

thanks

Author:  mightor [ Fri Jul 10, 2015 2:43 am ]
Post subject:  Re: #include files

Did you try placing it in the same folder as the .c file you're trying to compile?

= Xander

Author:  ronaldle [ Fri Jul 10, 2015 7:46 am ]
Post subject:  Re: #include files

Thanks for the help. I want to place it in the base directory of my robotC programs that I write. The following works just fine. Now I can have my own include files in one place which will work for any program that I am developing.

#include "C:\Users\R_Ledf\Documents\VexRobots\working_programs\VEX2\Ronstandard.h"

BTW, by placing the Ronstandard.h file in the working directory of the program that I was compiling, that worked also.

Thanks
Ronald

Author:  mightor [ Fri Jul 10, 2015 7:53 am ]
Post subject:  Re: #include files

There's a way you can have a standard folder be in the list of places the compiler will look for header files. You can do this form the preferences dialog, just set your Menu level to "Expert", through Window->Menu Level and then navigate to View->Preferences->Detailed Preferences:
Attachment:
Screenshot at 13-50-14.png
Screenshot at 13-50-14.png [ 20.99 KiB | Viewed 6668 times ]

Click on the "Browse" button and navigate to the folder where you'd like the compiler to look for .h files (C:\Users\R_Ledf\Documents\VexRobots\working_programs\VEX2\ in your case). Click Apply and OK to save and you should be good to go with just the file name to include :)

= Xander

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/