附使用Codeblocks和VisualStudio的代码:
#ifdef __GNUC__
#include <bits/stdc++.h>
#else
#include "bits/stdc++.h"
#pragma warning(disable:4996)
#endif // __GNUC__
using namespace std;
int main()
{
// freopen("in.txt","r",stdin);
// freopen("out.txt","w",stdout);
#ifndef __GNUC__
system("pause");
#endif // !__GNUC__
return 0;
}
本文探讨了在使用Codeblocks和VisualStudio进行编程时,如何通过预处理指令适应不同的编译器环境。展示了如何在GCC和非GCC编译器间切换包含文件,并禁用特定警告,确保代码在不同环境下的一致性和兼容性。
2213

被折叠的 条评论
为什么被折叠?



