A
A
Avery0072015-09-06 13:13:29
C++ / C#
Avery007, 2015-09-06 13:13:29

Why don't CLANG/GCC compile code that MSVC++ compiles?

CLANG/GCC do not see the string type in the global namespace if it is loaded there via using std::string (they only see if ::string is written instead of string), they also require . I didn't think they had different standards. How can I not step on such a rake?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Movchan, 2015-09-06
@Avery007

Потому, что gcc - компилятор языка C. Используйте g++.
Ошибку выбивает потому, что вы не подключили библиотеку libstdc++, в которой определены string и другие объекты стандартной библиотеки:
Просто, msvc++ и g++ делают это автоматически.

Сергей, 2015-09-06
@zenden2k

Вы всё врёти.
ideone.com/TbYMyy - gcc
ideone.com/GkOxM8 - clang

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question