includeing a file in robot c

When I include some files in a program I am working on, every include function has an error, what am I doing wrong?
heirs part of the code,

#include "CollisionDetection.c"
#include "Autonomous.c"
#include "waitForPress.c"
#include "waitForRelease.c"
#include "BeginnerMode.c"
#include "ExpertMode.c"
#include "IntermediateMode.c"

What is the error? You need to do these in the right order as the compiler reads from top down. So any variable in one included file needs to be defined in a previously included files.

Do these included files include other files? That can get messy and cause an error if you improperly include the same file twice (there is trick when doing that if this is the case).

Does the compiler find the files? Are they in the same directory or in the include path of robot C? (the places it looks for files)

You need to have those files opened to be able to include them. Try that and I think it should work. Sometimes you might also get error messages because, the files you are including have “task main”. Mostly if you include a file, you want to change “task main” to some else such as “task drive”. You only need “task main” for the main program.

This is the error, “Couldn’t open ‘#include’ file ‘Autonomous.c’”
where does the compiler look for files?
one of the included does include a another file.

I’m confused with this program, the first time I compiled, with all the included files, their wore no errors.

That didn’t fix the problem.

That isn’t true.

The simple way ROBOTC looks for files is being in the same folder as the file you are compiling.

@tabor473 Oh ok, I had the same problem and when I did that it worked. My bad then. Sorry for the misunderstanding.

OK, I moved the included files into the same folder that the main program is in, and it works now. Thanks for all the help.