我的C ++文件已使用mingw32成功编译,但无法正常工作什么问题? [关闭]

我用mingw32编译了c ++文件。它已成功编译,但无法正常工作。有什么问题?

我的命令:x86_64-w64-mingw32-g ++ -o xx test.cpp

评论
贪婪
贪婪

仅仅因为程序编译并不意味着它没有错误。它仅表示它在语法上有效。

编译器无法了解您的意图,因此显然无法标记代码中的任何逻辑错误。

There are also a lot of things in C++ that are valid syntax but that you are not allowed to do and invoke undefined behaviour. The compiler is not required to flag such issues, you have to know all the rules and abide by them. If any part of your code contains UB, the compiler has no obligation to generate anything sensible for any parts of your program.

就正确性而言,可以编译的东西几乎没有任何意义。这是一个非常低的酒吧。

点赞
评论