Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

Source subfolder and linking problem #763

Closed
@li3

Description

@li3

I'm trying to reorganize my project with subfolders, but I can't seem to get the linker to find the cpp sources once they're moved. The extension seems to magically find cpp files next to the main ino and compile them properly, how do I configure this?

I want to go from this (working structure):

project/
├── src/
    ├── app.ino
    ├── some_utility.h
    └── some_utility.cpp

To this structure:

project/
├── src/
    ├── app.ino
    └── utilities/
         ├── some_utility.h
         └── some_utility.cpp

This is my c_cpp_properties.json file.

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "C:/Program Files (x86)/Arduino/hardware/arduino/avr/cores/arduino",
                "C:/Program Files (x86)/Arduino/hardware/arduino/avr/variants/standard",
                "C:/Program Files (x86)/Arduino/hardware/tools/avr/avr/include",
                "C:/Program Files (x86)/Arduino/hardware/tools/avr/avr/include/avr",
                "C:/Program Files (x86)/Arduino/hardware/tools/avr/lib/gcc/avr/5.4.0/include",
                "C:/Program Files (x86)/Arduino/hardware/arduino/avr/libraries/**",
                "${workspaceFolder}/src/**",
                "${workspaceRoot}/src/**"
            ],
            "forcedInclude": [
                "C:/Program Files (x86)/Arduino/hardware/arduino/avr/cores/arduino/Arduino.h"
            ],
            "intelliSenseMode": "gcc-x64",
            "compilerPath": "C:/Program Files (x86)/Arduino/hardware/tools/avr/bin/avr-g++.exe",
            "defines": [
                "USBCON",
                "ARDUINO=100",
                "ARDUINO_AVR_NANO",
                "ARDUINO_ARCH_AVR",
                "__AVR_ENHANCED__"
            ],
            "cStandard": "c11",
            "cppStandard": "c++17"
        }
    ],
    "version": 4
}

Note, its unclear if ${workspaceFolder} or ${workspaceRoot} should be used anymore.

Apologies if this is actually a vscode-cpptools question, its kind of tricky to tell where one ends and the other begins sometimes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions