How To Exclude cpp/h files from .ino project build

Hello,
I am writing an ARDUINO Robot application using Windows MFC/Win32 in Visual Studio.
Some of these VS project cpp/h files I want to become part of an IDE2 Arduino sketch.
So I have created a .ino file in the VS project folder and made it the same name as VS the project name.
However when I open the .ino with IDE2 it imports all the VS cpp/h files.
Problem is many of these cpp/h files are Windows MFC/Win32 specific and are not wanted in the Arduino build. Is there a way to exclude the unwanted MFC/Win32 cpp/h from the Arduino IDE2 build please?
Many thanks in advance IMK

The sketch builder will compile all the source in

  • the sketch root, which contains the .ino
    • in the "src" subdirectory
      • and all of its subdirectories
    • But it will ignore all other subdirectories

So if you can arrange your project so that the Windows-specific stuff is under "windows" for example, that would be easiest. All the common stuff would be under "src".

After that you'd use the regular method of doing cross-platform stuff in the same file: using #ifdef ARDUINO for the Arduino stuff, and whatever the equivalent is on Windows.

1 Like

Copy the files to the sketch directory.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.