加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c – 代码块的Exe构建几乎是Visual Studio构建的相同代码的57倍

发布时间:2020-12-16 09:32:43 所属栏目:百科 来源:网络整理
导读:这段代码: #include iostreamusing namespace std;int main(){ cout "Hello world!n"; return 0;} 当com ::在GCC 4.4.1的Code :: Blocks中给出大小为457KB,在VS2010中只有8KB(8).这两个编译器都针对大小进 谁知道为什么会有这样的差异? 解决方法 你是对的
这段代码:

#include <iostream>
using namespace std;

int main()
{
    cout << "Hello world!n";
    return 0;
}

当com ::在GCC 4.4.1的Code :: Blocks中给出大小为457KB,在VS2010中只有8KB(8).这两个编译器都针对大小进

谁知道为什么会有这样的差异?

解决方法

你是对的,gcc的可执行文件显然更大,在你的情况下比vc构建的可执行文件大57倍.

The main reason is the one made with
GCC won’t require any external
dependencies to run while the one made
with VS2010 would need at least its runtime
files to be present on the system.

例如,假设您在没有安装vs2010的朋友的计算机上尝试它,而是尝试像XP这样的早期操作系统,甚至没有VS2010运行时的机会.

使用GCC构建的那个将没有问题,而使用VS2010制作的那个将抛出缺少运行时文件(依赖性)的错误.

希望这有帮助,如果没有,或者你有任何其他问题在脑海中,请随意提问,我会很乐意帮助:)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读