Я работаю над заданием C ++ для моего класса EECS 281, используя Visual Studio 2019 с помощью инструментов V142 и Windows SDK 10.0. < /p>
Когда я пытаюсь включить и вызовать стандартные функции C, такие как STRCMP, я получаю ошибки, такие как: < /p>
У глобального сфера нет strtok ». /> Global Scope не имеет "strcmp" < /p>
Нажмите на ошибку, которая приводит меня в реализацию MSVC, где строка
с использованием _cstd strcmp; подчеркнут той же ошибкой. < /p>
Я не мог понять, что пошло не так. < /p>
#include "String.h"
#include
#include
#include
#include
#include
/*
* The test case used here is identical to the test cases run on
* the Autograder. The score you see at the bottom of your output
* should be your score on the lab.
*/
// Use these to test individual operations all at once:
#define TEST_ERASE 72
#define TEST_INSERT 73
#define TEST_REPLACE 74
#define TEST_FFO 75
#define TEST_FLO 76
#define TEST_ALL 77
size_t npos = std::numeric_limits::max();
char a_null_byte = '\0';
// strcmp is underlined and displays the global scope error
bool check_sol(String& act, String& exp) {
return strcmp(act.c_str(), exp.c_str()) == 0;
}
//This is not my actual code but an example
< /code>
Я попытался поместить в препроцессор «CRT_SECURE_NO_WARNINGS», но это не удалось. Это могло быть ненужным.>
Подробнее здесь: https://stackoverflow.com/questions/797 ... or-in-msvc