我正在按照本教程在 Windows 上构建 GLFW,但在运行时遇到错误cmake -S . -B Build:
PS ~\glfw-3.3.2\GLFW> cmake -S . -B Build
CMake Error at CMakeLists.txt:3 (project):
Running
'nmake' '-?'
failed with:
The system cannot find the file specified
-- Configuring incomplete, errors occurred!
See also "~/glfw-3.3.2/GLFW/Build/CMakeFiles/CMakeOutput.log".
Run Code Online (Sandbox Code Playgroud)
输出日志几乎完全为空,仅包含我的 Windows 版本的一行。我还没有找到任何与我的匹配的讨论或问题。我什至不知道 nmake 是否有-?标志,因为它没有在微软文档网站上列出。
我尝试过定位在其他文件夹中,因为也许就是这种情况。但没有运气。
我尝试用其他错误解决方案来解决它,但无济于事。
此代码给出错误
不允许不完整的类型
初始值设定项过多
string *ReturnTwoStringsInArray()
{
return new string[]{"return1", "return2"};
}
Run Code Online (Sandbox Code Playgroud)
这个有效:
string *ReturnTwoStringsInArray()
{
return new string[2]{"return1", "return2"};
}
Run Code Online (Sandbox Code Playgroud)
这个也是如此:
string arr[]{"return1","return"};
Run Code Online (Sandbox Code Playgroud)
如果编译器可以从初始值设定项列表中确定所需的大小,我们不应该能够new不带参数地调用[]吗?
class A
{
private:
int a;
public:
int get_a()
{
return a;
}
A(int mode)
{
a = 0;
}
A()
{
a = 5;
}
};
class B
{
public:
A b(0);
};
class C
{
int c;
public:
C(int mode)
{
c = 0;
}
C()
{
c = 1;
}
};
int main()
{
B bb;
C cc(0);
//cout << bb.b.get_a();
system("pause");
return 0;
}
Run Code Online (Sandbox Code Playgroud)
如果我在 B 类中的 b 上使用 () 括号它会在我切换到 {} 时出现错误,一切都很好。我的问题是不应该允许我这样做,因为在 main 中的 cc …