Separate files questions

Code::Blocks 16.01

After trying to learn how to separate my program into files (after watching some videos) and some testing I have some questions:

File Policy:

Unchecking "Add paths to project" auto-unchecks "Use relative path", which program works.

Leaving both "Add paths to project" and "Use relative path" checked works.

But leaving "Add paths to project" checked, while unchecking "Use relative path" will cause error: No such file or directory.

Why is this?

And is it better to leave both checked or unchecked? Or no difference?

Also, it seems that for the main.cpp file you must include all of your .h or header files. For my test.cpp file I needed to add #include <iostream> and using namespace std. But nothing needed to be added to my .h file. Is this basically it on what needs to be added to which file?

Thanks.
leaving "Add paths to project" checked, while unchecking "Use relative path" will cause error:

I can’t remember having had any bad experience leaving those options to their default values, but I moved to Qt Creator long time ago and perhaps my memory betrays me.

Official Code::Blocks documentation is not of much help
http://wiki.codeblocks.org/index.php/Class_Wizard_plugin
But a guy in this post
http://stackoverflow.com/questions/21500724/c-undefined-reference-to-winmain16-codeblocks
suggests not to tick “Use relative path”.

Having re-installed Code:Blocks and created three empty class A, B and C playing with those options, I couldn’t find any difference, but for a row added in the ‘.cbp’ file (which you can open with a normal text editor):
<Add directory="/home/...[path to the project]..."

I’m sorry not being able to give you better advice, even because my instinct would be to set the relative path option on, because it sounds like it could allow you to move your project from a pc to another just copying the containing folder. But perhaps you could find more information on some Code::Blocks specific forum.

Anyway, it’s a well known bug of Code::Blocks that it doesn’t work properly the first time: it needs to be closed and restarted. Maybe, after having restarted it, in new projects you won't meet all those compilation errors.

it seems that for the main.cpp file you must include all of your .h or header files.

Well, it should not... or perhaps I don’t understand the issue.

Please, try restarting and creating a new project. If it doesn’t solve, just post again, but adding your code, and perhaps somebody would find the solution.
Thanks for the reply.

I didn't have any issues or errors (except if I chose the 3rd option), which kind of makes since now that I think about it.

Thanks again.
Topic archived. No new replies allowed.