View unanswered posts | View active topics It is currently Tue Sep 30, 2014 4:34 pm






Reply to topic  [ 5 posts ] 
header files 
Author Message
Rookie

Joined: Thu Nov 06, 2008 4:35 pm
Posts: 12
Post header files
Hello, today i was going to try to organize my code and put code into a header file and include it like so (#include "Name.h") and all worked fine... but when i open the file it listed errors, it didn't list errors in the main program though. This is were i got confused. Is ROBOTC unable to work with .h? Dose this all ways happen and I just ignore the errors because they are not in the main program? Or is this just a human error? Thank you for your response!!!

_________________
Palm Harbor University High School, Robotics team Pandara #506


Mon Mar 16, 2009 3:55 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3223
Location: Rotterdam, The Netherlands
Post Re: header files
I use header files very often. Just make sure you use fewer than 14 files in total in your program and you should be fine.

Regards,
Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Mon Mar 16, 2009 7:27 pm
Profile WWW
Expert
User avatar

Joined: Tue Oct 14, 2008 7:16 pm
Posts: 171
Location: Investigating an unidentified ship sighted in Sector 31428
Post Re: header files
RobotC should have no problems with .h files; however if you have definitions, variables, functions, motors, etc., that are referenced in the header then when you open the header file alone you will get errors because the RobotC compiler doesn't know enough to go and look in the main program file because it isn't (and can't be) "included" in the header.

Unlike some well established IDEs (*hem* Visual Studio *hem* *hem* NetBeans *hem*), RobotC doesn't have the idea of a "project" file that keeps track of all the files in your project and thus knows where all of your definitions are, avoiding such errors; rather it leaves you to create the files by hand and only looks in the current file and includes for definitions. RobotC also FOOLISHLY :evil: :breakcomputer: compiles the program when you open it (find me an established IDE that does this and I will eat my heart out); so that's also why you get errors left in right when dealing with includes.

Just be sure to avoid circular includes and stick to the 14 file limit and you should be fine. :bigthumb:

_________________
Captain, Head programmer, School of the Arts, Silverbots Robtics Team #2890
Code:
using namespace System;
using namespace Genius;
using namespace Personality;
public ref class Nerd : Geek, IAnserable
{
    Geek::Type brainMode = Geek::Type::Programmer;
}


Mon Mar 16, 2009 7:51 pm
Profile
Rookie

Joined: Thu Nov 06, 2008 4:35 pm
Posts: 12
Post Re: header files
Thank you , I was starting to panic. I don't like errors and debuging can be a real pain. I can say I am relived!

_________________
Palm Harbor University High School, Robotics team Pandara #506


Mon Mar 16, 2009 9:33 pm
Profile
Expert
User avatar

Joined: Tue Oct 14, 2008 7:16 pm
Posts: 171
Location: Investigating an unidentified ship sighted in Sector 31428
Post Re: header files
Glad to be of service. :D :wink: . I know that RobotC doesn't give programmers, espicially those unfamiliar with programming, much help in dealing with its hard core, down-and-dirty brand of programming. We get no help with this editor and the debugger can barely be called a debugger in my opinion. Oh well, just keep on treking, or typing as the case were. :programmer: :bigthumb:

_________________
Captain, Head programmer, School of the Arts, Silverbots Robtics Team #2890
Code:
using namespace System;
using namespace Genius;
using namespace Personality;
public ref class Nerd : Geek, IAnserable
{
    Geek::Type brainMode = Geek::Type::Programmer;
}


Mon Mar 16, 2009 11:14 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.