Linux编译生成

来源:互联网 发布:怎么找网络推手 编辑:程序博客网 时间:2024/06/14 09:39

//test.cpp如下

#include <iostream>

using namespace std;

int main()
{
    cout<<"this is a test."<<endl;
    return 0;
}

1.生成exe文件的命令如下:g++ test.cpp -o test

   生成成功后,执行exe命令为:./test

如果在生成exe文件的时候,需要调用新的.so文件,则命令如下:g++ test.cpp a.so -o test


2.生成.so文件的命令如下:g++ test.cpp -fPIC -shared -o test.so

  

原创粉丝点击