Неопределенный символ ___gxx_personality_v0 в ссылке

string IP = HttpContext.Current.Request.Params["HTTP_CLIENT_IP"] ?? HttpContext.Current.Request.UserHostAddress;
49
задан ryan_s 15 October 2008 в 02:55
поделиться

2 ответа

Используйте

g++ test.cpp

вместо этого, так как это - код C++.

<час>

Или, если Вы действительно хотите использовать gcc, добавляют -lstdc++ к командной строке, как так:

gcc test.cpp -lstdc++

Выполнение md5 против эти a.out произведенный согласно каждому сценарию показывает, что это - тот же вывод.

, Но, да, g++, вероятно, делает Ваш мир более простым местом.

77
ответ дан 3 revs, 2 users 67% 15 October 2008 в 02:55
поделиться

The .cpp extension causes gcc to compile your file as a C++ file. (See the GCC docs.)

Try compiling the same file, but rename it to have a .c extension:

mv test.cpp
gcc test.c

Alternatively, you can explicitly specify the language by passing -x c to the compiler:

gcc -x c -c test.cpp -o test.o

If you run nm test.o on these C-language versions, you'll notice that ___gxx_personality_v0 is not listed as a symbol.
(And if you run the same command on an object file generated with gcc -c test.cpp -o test.o, the ___gxx_personality_v0 symbol is present.)

4
ответ дан 7 November 2019 в 10:57
поделиться