<p>When <strong>Eclipse</strong> creates a new file (<strong>.c</strong> or <strong>.h</strong> file) in a C project the editor always auto creates a <code>#define</code> at the top of the file like this: If the file is named 'myCFile.c' there will be a <code>#define</code> at the start of the file like this</p>

<pre><code>#ifndef MYCFILE_C_
#define MYCFILE_C_
</code></pre>

<p>I have seen other editors do this as well (Codewright and SlikEdit I think). 
The <code>#defines</code> don't seem to do anything for the editor as I can just delete them without any problem, and I can't think of a reason why <em>I</em>  would want to use them. Does anyone know why they are there?   </p>

[{'answer_id': 37668, 'author': 'Eugene Yokota', 'author_id': 3827, 'author_profile': 'https://Stackoverflow.com/users/3827', 'pm_score': 3, 'selected': True, 'text': '<p>It\'s to guard against <a href="http://www.fredosaurus.com/notes-cpp/preprocessor/ifdef.html" rel="nofollow noreferrer">multiple definitions</a>.</p>\n'}, {'answer_id': 37669, 'author': 'Gishu', 'author_id': 1695, 'author_profile': 'https://Stackoverflow.com/users/1695', 'pm_score': 0, 'selected': False, 'text': "<p>I think it's a throwback of C include issues, where multiple copies of the source would get included - unless you are meticulous with include chains (One file includes n others).\nChecking if a symbol is defined and including only if the symbol is defined - was a way out of this.</p>\n"}, {'answer_id': 37673, 'author': 'Jim Buck', 'author_id': 2666, 'author_profile': 'https://Stackoverflow.com/users/2666', 'pm_score': 2, 'selected': False, 'text': '<p>Sometimes people include a whole .c file in other .c files (or even .h files), so it has the exact same purpose of preventing an include file from getting included multiple times and the compiler spitting out multiple definition errors.</p>\n\n<p>It is strange, though, that it would be the default behavior of an editor to put this in anything but a .h file. This would be a rarely needed feature.</p>\n'}, {'answer_id': 38416, 'author': '1800 INFORMATION', 'author_id': 3146, 'author_profile': 'https://Stackoverflow.com/users/3146', 'pm_score': 1, 'selected': False, 'text': '<p>A more modern version of this is to use:</p>\n\n<pre><code>#pragma once\n</code></pre>\n\n<p>It is quite unusual to see this in a .c file, normally it is in the header files only.</p>\n'}]
['https://Stackoverflow.com/questions/37665', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2079/']