#avr Logs

Apr 13 2019

#avr Calendar

12:02 AM gsi__ is now known as gsi_
03:58 AM paulo_ is now known as Guest11584
07:18 AM matthias__: Hello, when using -flto (from the question yesterday) I get warning: type 'struct Message_Builder' violates the C++ One Definition Rule [-Wodr] for each member definition of a class. note: a different type is defined in another translation unit header: https://bpaste.net/show/d1a34875fb97 source: https://bpaste.net/show/f3dbd3a02905 I'm linking both into a library which I'm using in my main program
07:19 AM matthias__: I have other libraries created the same way, but no warning is thrown for them
07:20 AM polprog: can you post the compiler output?
07:20 AM tpw_rules: maybe #pragma once isn't working correctly? i don't actually know c++ lol
07:21 AM matthias__: this is the whole error message: https://bpaste.net/show/74757ea56d83
07:21 AM polprog: are you tryng to compile the hpp file as well?
07:22 AM matthias__: tpw_rules: it is the same error as with the c -way #ifdef ....
07:23 AM matthias__: polprog: no, I'm just including the cpp file to the library
07:23 AM polprog: what do you mean?
07:23 AM tpw_rules: with an #include?
07:23 AM polprog: you should include the hpp file
07:24 AM matthias__: polprog: I meant in the cmake add_library call
07:25 AM matthias__: I'm only including the "message_builder.hpp" file
07:26 AM tpw_rules: also btw you've got a pretty nice buffer overflow opportunity
07:26 AM polprog: wow
07:26 AM matthias__: tpw_rules: i know when size exceeds, the class is not ready yet
07:27 AM matthias__: polprog: the headers are for declaration and the cpp files are for defintion. So i don't think the problem lays with the #include
07:28 AM polprog: somehow your compiler sees the definition twice
07:31 AM matthias__: as I said at the beginning only with the option -flto
07:33 AM polprog: hmm
07:45 AM matthias__: The error happens after this cmd: /usr/bin/avr-g++ -Os -mmcu=atmega1284 -Wl,--gc-sections -mrelax -Wl,-Map,firmware-atmega1284.map CMakeFiles/firmware-atmega1284.elf.dir/main.cpp.obj -o firmware-atmega1284.elf ../libs/pjon/libpjon-atmega1284.a ../libs/serial/libserial-atmega1284.a ../libs/timing/libtiming-atmega1284.a ../libs/message/libmessage-atmega1284.a
08:20 AM matthias__: polprog: tpw_rules: I found the error. The problem is the #ifndef MESSAGE_BUILDER_BUFFER_SIZE in the .hpp file. I do the #define in my main program and for library linking the default size is assumed and if it is not equal to the defintion in my main, the compiler crashes
08:21 AM matthias__: * when linking the lib with the main.cpp. So my problem is now how to pass the buffer-size :D
08:22 AM matthias__: I think i will do a set_buffer function and allocate the buffer in the main. Or do you have a better idea in mind?
08:26 AM polprog: cant you make it a constructor? youre writing cpp anyway
08:26 AM paulo_ is now known as Guest90551
08:32 AM matthias__: polprog: yes, i'm giving the buffer over the constructor and not with a separate function
08:33 AM matthias__: like this: Message_Builder message_builder(&message_buffer[0], sizeof(message_buffer));
08:44 AM polprog: whats the declatarion of message_buffer
10:35 AM paulo_ is now known as Guest31269
10:48 AM matthias__: polprog: it's just unint8_t buffer[SIZE];
10:49 AM polprog: ok, i was afraid that sizeof was being used wrong
10:49 AM polprog: i have no ide why lto makes those errors
11:51 AM rue_mohr: --
01:53 PM vmt: hullo
01:54 PM polprog: hello
01:54 PM vmt: what's up
01:55 PM polprog: tons of stuff
01:55 PM polprog: sitting at home for the whole week, was feeling sick yesterday and today
01:55 PM polprog: im getting better
01:55 PM polprog: might make up another 485 slave tomorrow, i hope im not out of max485 yet
01:56 PM vmt: what are you making?
01:57 PM polprog: a bunch of 485 boards to play with
02:02 PM vmt: mmh. hey, how's that demo project coming along?
02:02 PM polprog: havent done much apart from redoing the scene rendering
02:03 PM polprog: there is now a global function array that gets called in a loop and each function runs in a loop internally to render a single "scene"
02:03 PM polprog: i need to get that polished up too.
03:31 PM ephemer0l is now known as ephemer0l_
08:22 PM day_ is now known as day
08:42 PM day___ is now known as day
08:49 PM day___ is now known as day
08:59 PM day_ is now known as day
09:06 PM day_ is now known as day
11:43 PM [1]MrMobius is now known as MrMobius
11:54 PM day_ is now known as day