Skip to content

Conversation

@LittleBuster
Copy link
Contributor

Ошибка сборки при инклуде Settings.h в несколько .cpp файлов

Linking .pio\build\4d_systems_esp32s3_gen4_r8n16\firmware.elf
c:/users/denis/.platformio/packages/toolchain-xtensa-esp32s3/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: .pio/build/4d_systems_esp32s3_gen4_r8n16/src/webgui.cpp.o: in function `sets::beginOta(bool, bool)':
C:\Users\Denis\Documents\PlatformIO\Projects\GyverGUITest/.pio/libdeps/4d_systems_esp32s3_gen4_r8n16/Settings/src/core/ota.h:15: multiple definition of `sets::beginOta(bool, bool)'; .pio/build/4d_systems_esp32s3_gen4_r8n16/src/main.cpp.o:C:\Users\Denis\Documents\PlatformIO\Projects\GyverGUITest/.pio/libdeps/4d_systems_esp32s3_gen4_r8n16/Settings/src/core/ota.h:15: first defined here
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\4d_systems_esp32s3_gen4_r8n16\firmware.elf] Error 1
============================================================================= [FAILED] Took 6.39 seconds =============================================================================

Пример программы:

main.cpp

#include <Arduino.h>
#include "webgui.hpp"

void setup() {
  WebGUI.begin();
}

void loop() {
}

webgui.hpp

#ifndef __WEB_GUI_HPP__
#define __WEB_GUI_HPP__

#include <SettingsAsync.h>

class WebGUIClass : public SettingsAsync
{
public:
    void begin();
};

extern WebGUIClass WebGUI;

#endif /* __WEB_GUI_HPP__ */

webgui.cpp

#include "webgui.hpp"

void WebGUIClass::begin() {
}

WebGUIClass WebGUI;

@GyverLibs
Copy link
Owner

Точно, спасибо

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants