Windows下使用mingw的g++编译的程序怎么在别人电脑运行

需要静态链接标准库,在链接过程中使用 -static

makefile的头部可这么写

CXX              :=g++
CXXFLAGS         :=  -std=c++11 -O3 -fopenmp -Wfatal-errors
LINKFLAGS        :=
#If the operating system is windows
ifeq ($(OS),Windows_NT)
LINKFLAGS += -static
endif

猜你喜欢

转载自blog.csdn.net/X_And_Y/article/details/108018807
今日推荐