OSを作り直そうと思ってアセンブラで書いたブートローダからC++で書いたカーネルへ突撃!といきたいところだったが、カーネルのリンク時にエラー。
TextVRAM.cpp:4: undefined reference to `TextVRAM::buff'こんなエラーがずらーっと、参照できねーよって怒られてる。クラス変数はTextVRAM.hで定義しているはずだが全部エラーになってる模様。
#ifndef _TEXT_VRAM_ #define _TEXT_VRAM_ class TextVRAM{ public: static void init(); static void setCursor(const int x, const int y); static void write(const int x, const int y, const char ch); static void putChar(const char ch); static void print(char* str); static void println(char* str); private: static char* buff; static int curX; static int curY; static int width; static int height; static int size; }; #endif
それでリンクは以下のようにやった
ld -m elf_i386 -n -Ttext 0x8200 -static --start-group OSStart.o TextVRAM.o --end-group -o third.oそこでエラー。以前はstaticを使ってなかったから起こらなかったエラーにならなかったのだろうか?何かを見落としてる?