Почему я получаю эту ошибку?
Это безопасная ставка, что, несмотря на то, что сообщение об ошибке упоминает C99 , вы фактически используете компилятор, следуя более позднему стандарту, тот, в котором gets был удален, а не просто устарел.
Например, когда я пытаюсь скомпилировать следующую простую программу:
с clang под Ubuntu 18.04:
Я получаю ту же ошибку:
Это на самом деле касается только тангенциально связанных с устареванием и удалением gets (тем самым он больше не объявляется). Это больше связано с тем, что вы не должны пытаться использовать какую-либо функцию без активной декларации в соответствии с ISO C99 Foreword/5 (перефразируемое):
Это второе издание отменяет и заменяет C90 с внесенными в него поправками и исправлениями с помощью другого другого gumpf ISO. Основные изменения, произошедшие в предыдущем издании, включают:
удалить неявное объявление функции.
много других вещей, не имеющих отношения к этому вопросу.
Вы можете увидеть это, если заменить gets с xyzzy , что приводит к одной и той же ошибки:
В самом деле, если вы на самом деле пытаются использовать gets с C99 флагами, вы получите совершенно другое сообщение (или вообще, если ваш компилятор реализует C99, прежде чем они осуждается gets — это не было сделано до ТС3):
I’m trying to input strings in my C structure but it says «warning: implicit declaration of function ‘gets’ [-Wimplicit-function-declaration]» I used to code in Dev-c ++ and I’m practicing at GCC does anyone can help me how to do it.
Why am I getting this error?

1 Answer 1
It’s a safe bet that, even though the error message mentions C99 , you are in fact using a compiler following a later standard, one in which gets was removed rather than just deprecated.
For example, when I try to compile the following simple program:
with clang under Ubuntu 18.04:
I get that same error:
This is actually only tangentially related to the deprecation and removal of gets (in that it’s no longer declared anywhere). It’s more to do with the fact you shouldn’t be trying to use any function without an active declaration, as per ISO C99 Foreword /5 (paraphrased):
This second edition cancels and replaces C90, as amended and corrected by various other ISO gumpf. Major changes from the previous edition include:
remove implicit function declaration.
lots of other stuff, irrelevant to this question.
You can see this if you replace gets with xyzzy , which results in the same error:
In fact, if you actually try to use gets with the C99 flags set, you’ll get a totally different message (or none at all if your compiler implements C99 before they deprecated gets — that wasn’t done until TC3):