美文网首页
gcc指定编译32位(64位)指令

gcc指定编译32位(64位)指令

作者: fatshi | 来源:发表于2023-01-18 18:02 被阅读0次

    32位

    gcc -m32 test.cpp -o test.out               
    

    链接环节可能会出错,原因是缺少对应的32位库,毕竟现在默认都是64位的系统。需要执行如下指令安装对应库

    apt-get install build-essential module-assistant  
    apt-get install gcc-multilib g++-multilib  
    

    64位

    gcc -m64 test.cpp -o test.out   //OR gcc test.cpp -o test.out(一般默认是编译成64位程序的)
    

    [参考] https://blog.csdn.net/qq512028505/article/details/78239656

    相关文章

      网友评论

          本文标题:gcc指定编译32位(64位)指令

          本文链接:https://www.haomeiwen.com/subject/wmkfhdtx.html