int main(void){ int i[]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; int *pi; pi = &i[0]; while(*pi){ cout << inttochar16(*pi,36) << "\n"; pi++; } return 0; }
g++ -L/home/hoge/lib hello.cpp -o HELLO -lmylib -static /lib/libc.a(strcmp.o)(.text+0x0): In function `strcmp': multiple definition of `strcmp' /home/hoge/lib/libmylib.a(strcmp.o)(.text+0x0): first defined here collect2: ld returned 1 exit status
>>347 char*ではcatch出来ないのが正しい。const char*ではcatchできる。 ISO/IEC 14882:1998 15.1.3 The temporary object created for a throwexpression that is a string literal is never of type char* or wchar_t*;that is, the special conversions for string literals from the types “array of const char” and “array ofconst wchar_t” to the types “pointer to char” and “pointer to wchar_t”, respectively, are never applied to a throwexpression.
class mycls{ public: static int x; }; int main(){ mycls c; c.x = 2; return 0; } とするとgccのコンパイラに以下のように怒られるのですがなぜでしょうか. hoge/hoge/hoge.o(.text$_...(略)...) undefined reference to mycls::x collect2: ld returned 1 exit status