Skip to content

Including interp_1d in a big C++ project #2

@blindProgrammer

Description

@blindProgrammer

Hi, I have this issue when it comes to including the interp_1d header in a big c++ project. I have the following configuration, where each .hpp file shown below has a corresponding .cpp file:

myPulse.hpp:
#include "nr3.hpp"
#include "interp_1d.hpp"

calc1.hpp:
#include "myPulse.hpp"

calc2.hpp:
#include "myPulse.hpp

main.cpp:
#include "myPulse.hpp"
#include "calc1.hpp"
#include "calc2.hpp"
#include "nr3.hpp"
#include "interp_1d.hpp"

This returns the error: "66 duplicate symbols for architecture x86_64", where basically the contents of interp_1d.hpp are being read three times. The issue is resolved when I remove the interp_1d.hpp header from main and from myPulse.hpp header, and instead include it in myPulse.cpp, but this is a very dirty way of solving it and I still can only use it in myPulse.cpp.
I tried adding the following header guards to the interp_1d header:

#ifndef INTERP_1D_HPP
#define INTERP_1D_HPP

#endif

but it didn't fix the issue. Can someone help me with this issue? I basically want to use interp_1d techniques in multiple classes in my project but can't seem to be able to.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions