无法找到过程入口点
The procedure entry point could not be located
我正在尝试在 Windows 10 上使用 MinGW 编译 C++ 程序,但我不断收到以下错误(-Wall 和 -Werror 已激活):
The procedure entry point
_ZNSt7__cxx1112basic_stringlcSt11char_traitslcESalcEEC1EPKcRKS3_
could not be loaded in the dynamic link library
[path to executable].exe
我为类似的东西找到的其他解决方案引用了外部 DLL,而不是可执行文件本身。
我是 C# 专家,这对我来说很陌生,如果这是一个非常简单的链接错误或类似问题,请原谅我。
一切都在一个文件中(因为它将由在线自动法官评分):
#include <iostream>
#include <string>
enum Months { January, February, March, April, May, June, July, August, September, October, November, December };
std::string monthNames[] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" };
int monthLengths[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
int main(int argc, char const *argv[]);
bool isLeapYear(int year);
int daysInMonth(Months month, int year);
int main(int argc, char const *argv[])
{
std::cout << "Leap years:" << std::endl;
for (size_t i = 0; i < sizeof(monthNames)/sizeof(*monthNames); ++i)
{
std::cout << monthNames[i] << ": " << daysInMonth(static_cast<Months>(i), 2000) << std::endl;
}
std::cout << "Non-leap years:" << std::endl;
for (size_t i = 0; i < sizeof(monthNames)/sizeof(*monthNames); ++i)
{
std::cout << monthNames[i] << ": " << daysInMonth(static_cast<Months>(i), 1999) << std::endl;
}
std::cin.ignore();
return 0;
}
bool isLeapYear(int year)
{
return ((year & 3) == 0 && ((year % 25) != 0 || (year & 15) == 0));
}
int daysInMonth(Months month, int year)
{
if (isLeapYear(year) && month == February)
{
return 29;
}
return monthLengths[month];
}
您需要包含字符串 header 才能使用字符串。
这实际上只是我的 MinGW 安装的问题(我在其他地方使用了一个 g++ 版本,它运行得很好)。
我正在尝试在 Windows 10 上使用 MinGW 编译 C++ 程序,但我不断收到以下错误(-Wall 和 -Werror 已激活):
The procedure entry point
_ZNSt7__cxx1112basic_stringlcSt11char_traitslcESalcEEC1EPKcRKS3_
could not be loaded in the dynamic link library
[path to executable].exe
我为类似的东西找到的其他解决方案引用了外部 DLL,而不是可执行文件本身。
我是 C# 专家,这对我来说很陌生,如果这是一个非常简单的链接错误或类似问题,请原谅我。
一切都在一个文件中(因为它将由在线自动法官评分):
#include <iostream>
#include <string>
enum Months { January, February, March, April, May, June, July, August, September, October, November, December };
std::string monthNames[] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" };
int monthLengths[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
int main(int argc, char const *argv[]);
bool isLeapYear(int year);
int daysInMonth(Months month, int year);
int main(int argc, char const *argv[])
{
std::cout << "Leap years:" << std::endl;
for (size_t i = 0; i < sizeof(monthNames)/sizeof(*monthNames); ++i)
{
std::cout << monthNames[i] << ": " << daysInMonth(static_cast<Months>(i), 2000) << std::endl;
}
std::cout << "Non-leap years:" << std::endl;
for (size_t i = 0; i < sizeof(monthNames)/sizeof(*monthNames); ++i)
{
std::cout << monthNames[i] << ": " << daysInMonth(static_cast<Months>(i), 1999) << std::endl;
}
std::cin.ignore();
return 0;
}
bool isLeapYear(int year)
{
return ((year & 3) == 0 && ((year % 25) != 0 || (year & 15) == 0));
}
int daysInMonth(Months month, int year)
{
if (isLeapYear(year) && month == February)
{
return 29;
}
return monthLengths[month];
}
您需要包含字符串 header 才能使用字符串。
这实际上只是我的 MinGW 安装的问题(我在其他地方使用了一个 g++ 版本,它运行得很好)。