that persistence thing is pretty funky!

alright, been trying to get the handlers thing up and running.
had to remove #include "u8g2/U8g2LinuxI2C.h" from osc-handlers.h because of multiple definitions.

in the end, still getting this error:

no matching function for call to 'handleProject0' column: 11, line: 506
/root/Bela/projects/O2OPepperSplit/main.cpp:506:11: error: no matching function for call to 'handleProject0'
error = handleProject0(u8g2, args);
^~~~~~~~~~~~~~
/root/Bela/projects/O2OPepperSplit/osc-handlers.h:10:12: note: candidate function not viable: no known conversion from 'oscpkt::Message::ArgReader' to 'const oscpkt::Message' for 2nd argument
enum Error handleProject0(U8G2& u8g2, const oscpkt::Message& msg);
^
1 error generated.
make: *** [/root/Bela/projects/O2OPepperSplit/build/main.o] Error 1

wish i knew how to solve this myself, but can someone hold my hand on this one as well?

thanks for a swift reply on a saturday!

that seems to have fixed that error, however now i'm getting this one about the #include at the top of the handleproject0.cpp file:

expected "FILENAME" or <FILENAME> column: 10, line: 1
/root/Bela/projects/O2OPepperSplit/handleProject0.cpp:1:10: error: expected "FILENAME" or <FILENAME>
#include
^
1 error generated.
make: *** [/root/Bela/projects/O2OPepperSplit/build/handleProject0.o] Error 1

feels like this is getting awfully close to working though 🙂

too bad my C++ knowledge is rather limited - find myself going back and forth to online manuals and explainers since i'd like to at least understand whats going on, but i still find myself scratching my head rather often.

like i have some questions about why everything seems to be included in a sort of error-determination-package, but maybe that would take this too far

I left a blank there for no reason...
That should be #include "osc-handlers.h"

well. hmm.
if i #include "u8g2/U8g2LinuxI2C.h" in osc-handlers.h i get the 'multiply defined' errors.
and if i don't include it, it seems to not know what to do without it?

In file osc-handlers.h: unknown type name 'U8G2' column: 27, line: 10
In file osc-handlers.h: unknown type name 'U8G2' column: 27, line: 11
unknown type name 'U8G2' column: 27, line: 2
use of undeclared identifier 'error' column: 4, line: 8
use of undeclared identifier 'u8g2_font_ncenB08_tr' column: 17, line: 12
use of undeclared identifier 'displayHeight' column: 20, line: 14
use of undeclared identifier 'error' column: 9, line: 19

    Remork if i #include "u8g2/U8g2LinuxI2C.h" in osc-handlers.h i get the 'multiply defined' errors.

    good, this one is not my fault. I don't have time to look into this right now, but what are the symbols that get "multiply defined" ?

      giuliomoro replace the definition of the error variable with a simpler enum Error error = kOk.

      if i move that definition to the beginning of main.cpp osc-handlers.h
      so it's not inside the parsing function, but rather under the enum Error {} , that improves matters.

      i also added #include "u8g2/U8g2LinuxI2C.h" to handleProject0.cpp instead.

      i'm down to three errors now:

      In file osc-handlers.h: unknown type name 'U8G2' column: 27, line: 13
      In file osc-handlers.h: unknown type name 'U8G2' column: 27, line: 14
      In file handleProject0.cpp: use of undeclared identifier 'displayHeight' column: 20, line: 16

      if i move int displayHeight = 64 to osc-handlers.h, that gets rid of the last error.
      (moved its brother displayWidth along. constants for a single OLED in my case)

      i figured, since both .cpp files include the handlers.. not sure if that is good practice?

      not sure what to do about the final two errors though.

      In file osc-handlers.h: unknown type name 'U8G2' column: 27, line: 13
      In file osc-handlers.h: unknown type name 'U8G2' column: 27, line: 14

      for clarity, osc-handlers.h now looks like this:

      #include <oscpkt.hh>
      int displayWidth = 128;
      int displayHeight = 64;
      enum Error {
      kOk = 0,
      kUnmatchedPattern,
      kWrongArguments,
      kInvalidMode,
      kOutOfRange,
      };
      enum Error error = kOk;
      enum Error handleProject0(U8G2& u8g2, const oscpkt::Message& msg);
      enum Error handleProject1(U8G2& u8g2, const oscpkt::Message& msg);

        giuliomoro but what are the symbols that get "multiply defined" ?

        am i getting ahead of myself moving #include "u8g2/U8g2LinuxI2C.h" to handleProject0.cpp?
        just dabbling :/

        let me move that back to the header for you.
        here goes:

        In file u8g2/U8g2LinuxI2C.h: redefinition of 'U8G2LinuxI2C' column: 7, line: 12
        In file u8g2/U8g2LinuxI2C.h: redefinition of 'U8G2_SH1106_128X64_NONAME_F_HW_I2C_LINUX' column: 7, line: 20
        In file u8g2/U8g2LinuxI2C.h: redefinition of 'U8G2_SSD1306_128X64_NONAME_F_HW_I2C_LINUX' column: 7, line: 26
        In file u8g2/U8g2LinuxI2C.h: redefinition of 'U8G2_SSD1309_128X64_NONAME2_F_HW_I2C_LINUX' column: 7, line: 32

        In file included from /root/Bela/projects/O2OPepperSplit/main.cpp:27:
        In file included from /root/Bela/projects/O2OPepperSplit/osc-handlers.h:2:
        /root/Bela/projects/O2OPepperSplit/u8g2/U8g2LinuxI2C.h:12:7: error: redefinition of 'U8G2LinuxI2C'
        class U8G2LinuxI2C : public U8G2 {
        ^
        /root/Bela/projects/O2OPepperSplit/u8g2/U8g2LinuxI2C.h:12:7: note: previous definition is here
        class U8G2LinuxI2C : public U8G2 {
        ^
        In file included from /root/Bela/projects/O2OPepperSplit/main.cpp:27:
        In file included from /root/Bela/projects/O2OPepperSplit/osc-handlers.h:2:
        /root/Bela/projects/O2OPepperSplit/u8g2/U8g2LinuxI2C.h:20:7: error: redefinition of 'U8G2_SH1106_128X64_NONAME_F_HW_I2C_LINUX'
        class U8G2_SH1106_128X64_NONAME_F_HW_I2C_LINUX : public U8G2LinuxI2C {
        ^
        /root/Bela/projects/O2OPepperSplit/u8g2/U8g2LinuxI2C.h:20:7: note: previous definition is here
        class U8G2_SH1106_128X64_NONAME_F_HW_I2C_LINUX : public U8G2LinuxI2C {
        ^
        In file included from /root/Bela/projects/O2OPepperSplit/main.cpp:27:
        In file included from /root/Bela/projects/O2OPepperSplit/osc-handlers.h:2:
        /root/Bela/projects/O2OPepperSplit/u8g2/U8g2LinuxI2C.h:26:7: error: redefinition of 'U8G2_SSD1306_128X64_NONAME_F_HW_I2C_LINUX'
        class U8G2_SSD1306_128X64_NONAME_F_HW_I2C_LINUX : public U8G2LinuxI2C {
        ^
        /root/Bela/projects/O2OPepperSplit/u8g2/U8g2LinuxI2C.h:26:7: note: previous definition is here
        class U8G2_SSD1306_128X64_NONAME_F_HW_I2C_LINUX : public U8G2LinuxI2C {
        ^
        In file included from /root/Bela/projects/O2OPepperSplit/main.cpp:27:
        In file included from /root/Bela/projects/O2OPepperSplit/osc-handlers.h:2:
        /root/Bela/projects/O2OPepperSplit/u8g2/U8g2LinuxI2C.h:32:7: error: redefinition of 'U8G2_SSD1309_128X64_NONAME2_F_HW_I2C_LINUX'
        class U8G2_SSD1309_128X64_NONAME2_F_HW_I2C_LINUX : public U8G2LinuxI2C {
        ^
        /root/Bela/projects/O2OPepperSplit/u8g2/U8g2LinuxI2C.h:32:7: note: previous definition is here
        class U8G2_SSD1309_128X64_NONAME2_F_HW_I2C_LINUX : public U8G2LinuxI2C {

        It seems that you need to add #pragma once at the top of u8g2/U8g2LinuxI2C.h

        Remork enum Error error = kOk;

        Don't make this global, rather have it inside each handler function.

        will try all that tomorrow.
        thanks so much already!

        alright!

        had some issues with displayHeight- not having that in handleProject.cpp caused an undefined variable error, and if i did put it in it caused a multiple definitions error.

        shouldn't the 'multiple definitions' mean that it could already see it in the first place, and that it should work fine without having it in? seems contradictory, but i'm sure i'll get my head around that one day 🙂

        anyway, moving the def back inside the parsing function in main.cppsmooths that out, and now at least it is compiled and running. HOORAY!

        still, no smooth sailing yet: if i send a bang from local.pd, as in

        bang
        |
        oscformat project0 test

        i get both the notification that it got and matched the message, AND an error:

        Message from 192.168.7.1:37358
        received /project0/test
        An error occurred with message to: /project0/test: unexpected types and/or length

        i can only assume the "received" is coming from the function inside handleProject0.cpp?
        which should cause a message on screen to appear. which it doesn't.

        if i send a float instead of a bang (just testing) i only get the error.

          ok. recompiled and now it's behaving.
          weird one that!
          will try to run a couple of times to see if it was a one off.

          then start to move code around and see how it goes.
          excited! thank you so much for your time!

            Remork it seems to be doing both the if and elseparts:

            I need to see the full function.

            Remork shouldn't the 'multiple definitions' mean that it could already see it in the first place, and that it should work fine without having it in?

            It's the difference between seeing it at compile time (where it looks at one cpp file and its includes at a time to build an object file) and at link time (where it links all objects together). For it not to fail at compile time it needs a global declaration: in one file you define the variable, e.g.: int displayWidth = 64;, in the others you declare it with extern, e.g. ; extern int displayWidth; then it knows the symbol exists somewhere (not in the current file) and will not try to define a new one. Anyhow, the best thing is probably not to use any globals at all and just get the screen size locally in the handler:

            int displayWidth = u8g2.getDisplayWidth();
            int displayHeight = u8g2.getDisplayHeight();

            ok, that makes sense. yes yes yes. thanks!

            ironing out the rough spots in the O2O code i had for one of the Pepper patches, but it would seem i'm up and running. which is amazing!