user48011: I want to test the algorithms in my code without needing to send it to an actual Arduino board. I figured I could lay out my project like:
project/
    core.cpp      # core algorithms
    core.h        # header for core.cpp
    project.ino   # Arduino setup() loop() calling into core
    pc-main.cpp   # main(argv) calling into core

However, when I do this, the Arduino IDE wants to compile pc-main.cpp, which won't work since it uses stdio and all that. What can I do instead?
Is there a way to hide a file from the build, other than changing the extension which would inconvenience other editors and compilers? Is there a different standard approach to this kind of problem?

What I've thought of:

I could put pc-main.cpp in another directory and have the build for it refer to the files in the Arduino project directory, but that seems awkward and I'd like a more elegant solution.
I could symlink the core.* files into the Arduino project directory from elsewhere, but that would also be inelegant, and inconvenience Windows users should one want to compile the project.
I could put an #ifdef around the contents of pc-main.cpp, but I haven't found a suitable #define to check for, other than board-specific ones.

I don't want a solution which requires extra steps for each build; the whole point of trying to do this is fast and easy development.
I would also prefer one which does not bring in a whole additional build system, testing framework, or IDE; for example, I found arduino_ci and PlatformIO while researching this question. I'll switch to looking at such options if there isn't a good solution to the problem as I've stated it here.

[My question is arguably the same as Project structure to build for PC and Arduino at a high level, but the question and answer there are broad and about organizing modules and not how to make the build actually work.]

user7508: I would use conditional compilation, like this:
#ifndef(ARDUINO)
// Non-Arduino code.
#endif


48011: <p>I want to test the algorithms in my code without needing to send it to an actual Arduino board. I figured I could lay out my project like:</p>

<pre><code>project/
    core.cpp      # core algorithms
    core.h        # header for core.cpp
    project.ino   # Arduino setup() loop() calling into core
    pc-main.cpp   # main(argv) calling into core
</code></pre>

<p><strong>However, when I do this, the Arduino IDE wants to compile <code>pc-main.cpp</code>, which won't work since it uses stdio and all that. What can I do instead?</strong></p>

<p>Is there a way to hide a file from the build, other than changing the extension which would inconvenience other editors and compilers? Is there a different standard approach to this kind of problem?</p>

<hr>

<p>What I've thought of:</p>

<ul>
<li><p>I could put <code>pc-main.cpp</code> in another directory and have the build for it refer to the files in the Arduino project directory, but that seems awkward and I'd like a more elegant solution.</p></li>
<li><p>I could symlink the <code>core.*</code> files into the Arduino project directory from elsewhere, but that would also be inelegant, and inconvenience Windows users should one want to compile the project.</p></li>
<li><p>I could put an <code>#ifdef</code> around the contents of <code>pc-main.cpp</code>, but I haven't found a suitable <code>#define</code> to check for, other than board-specific ones.</p></li>
</ul>

<p>I don't want a solution which requires extra steps for each build; the whole point of trying to do this is fast and easy development.</p>

<p>I would also prefer one which does not bring in a whole additional build system, testing framework, or IDE; for example, I found <a href="https://github.com/ianfixes/arduino_ci" rel="noreferrer">arduino_ci</a> and <a href="https://platformio.org/" rel="noreferrer">PlatformIO</a> while researching this question. I'll switch to looking at such options if there <em>isn't</em> a good solution to the problem as I've stated it here.</p>

<hr>

<p>[My question is arguably the same as <a href="https://arduino.stackexchange.com/questions/47812/project-structure-to-build-for-pc-and-arduino">Project structure to build for PC and Arduino</a> at a high level, but the question and answer there are broad and about organizing modules and not how to make the build actually work.]</p>
 7508: <p>I would use conditional compilation, like this:</p>

<pre class="lang-c++ prettyprint-override"><code>#ifndef(ARDUINO)
// Non-Arduino code.
#endif
</code></pre>
