Code: Select all
void Terminal::resizepanel(int column_factor, int row_factor)
{
auto panelPtr = &panels[panelindex];
static const Panel initial_panels[3] { panels[0], panels[1], panels[2] };
Code: Select all
void Terminal::resizepanel(int column_factor, int row_factor)
{
auto panelPtr = &panels[panelindex];
static const Panel initial_panels[3] { panels[0], panels[1], panels[2] };
I do have a memcpy function.b.zaar wrote:The static keyword moves the initial_panel from the stack to the data section. This would mean initializing it may use the internal memcpy.
A simple fix would be to create a small memcpy function.
Have you thought of making use of the information contained in the error message? What is the message?remyabel wrote:I do have a memcpy function.
That doesn't make sense. If you have a memcpy function, and you are including it in the object files to be linked, how are you getting an error that it is undefined? There's something wrong with your toolset.remyabel wrote:I do have a memcpy function.b.zaar wrote:The static keyword moves the initial_panel from the stack to the data section. This would mean initializing it may use the internal memcpy.
A simple fix would be to create a small memcpy function.
That or the name of that function could differ from memcpy, but we haven't been shown the actual error.iansjack wrote:That doesn't make sense. If you have a memcpy function, and you are including it in the object files to be linked, how are you getting an error that it is undefined? There's something wrong with your toolset.
Sorry for the late reply. The error message is what you'd expect:alexfru wrote:That or the name of that function could differ from memcpy, but we haven't been shown the actual error.iansjack wrote:That doesn't make sense. If you have a memcpy function, and you are including it in the object files to be linked, how are you getting an error that it is undefined? There's something wrong with your toolset.
Code: Select all
terminal.o: In function `Terminal::resizepanel(int, int)':
terminal.cpp:(.text+0x7d9): undefined reference to `memcpy'
terminal.cpp:(.text+0x7f3): undefined reference to `memcpy'
terminal.cpp:(.text+0x80d): undefined reference to `memcpy'
Code: Select all
void* memcpy(void* dest, const void* src, uint32_t len);
Objdump:Combuster wrote:What would be the entire linker command line, which file in there should contain the memcpy, and have you dumped all symbols from that file?
Code: Select all
objdump -t -C cstring.o
00000000 g F .text 00000037 memcpy(void*, void const*, unsigned long)
Code: Select all
void* memcpy(void* dest, const void* src, size_t len);
Code: Select all
void* memcpy(void* dest, const void* src, size_t len) {
uint8_t* ptrd = (uint8_t*) dest;
const uint8_t* ptrs = (uint8_t*) src;
for (; len != 0; len--)
*ptrd++ = *ptrs++;
return dest;
}
Code: Select all
../../i686-elf-4.9.0-Linux-x86_64/bin//i686-elf-g++ -T linker.ld -ffreestanding -O2 -nostdlib -o myos.bin \
boot.o gdt_asm.o idt_asm.o keyboard.o vsprintf.o kernel.o printf.o cstring.o gdt.o svga.o multiboot.o terminal.o parse.o font.o scanf.o idt.o -lgcc
Since you appear to be compiling C++ code and memcpy() is supposed to be a C function and C-callable function, it is important that it have the proper prototype in the eyes of the C++ compiler:remyabel wrote: Sorry for the late reply. The error message is what you'd expect:
The declaration of memcpy looks like:Code: Select all
terminal.o: In function `Terminal::resizepanel(int, int)': terminal.cpp:(.text+0x7d9): undefined reference to `memcpy' terminal.cpp:(.text+0x7f3): undefined reference to `memcpy' terminal.cpp:(.text+0x80d): undefined reference to `memcpy'
Code: Select all
void* memcpy(void* dest, const void* src, uint32_t len);
Code: Select all
extern "C"
{
void* memcpy(void* dest, const void* src, uint32_t len);
}