如何在不与 kernel32 链接的情况下编译 C++ 代码?

问题描述

我在 Windows 上使用 mingw 编译了以下 C++ 代码

#include <string>

int main(){
    std::string foo = "foo";
    foo.append("foo");
    return 0;
}

我使用以下命令编译: g++ test.cpp -o test.exe -static-libstdc++

然后我使用dependency walker查看了编译后的文件,我发现kernel32.dll是这个可执行文件使用的依赖项之一。我可以在不链接到此文件的情况下编译可执行文件吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)