A C++ compiler isn't different from any other 3rd party software component: it usually comes with certain license terms, and for using, redistributing or reselling the compiler one needs to obey them.
So now you have to choose among commercial and non commercial compilers for the platform(s) you want to support and check if their licenses will allow redistribution / reselling, and under which conditions. Maybe you need to buy a special license, or simply buy one compiler license per license of your own product (specifically for commercial compilers).
Alternatively, you could let the end user find and install a C++ compiler on their machines, within the range of certain products and versions. For lots of Linux distributions, this is quite simple. For example, when your C++ code targets for the GCC C++ compiler, which is under "GPLv3+", this avoids your own program to become subject of the viral nature of the GPL family (which would otherwise force you to put your own program under GPL as well).
If you have further questions about the license terms of FOSS C++ compilers, I recommend you ask them on opensource.stackexchange.com. If you have questions questions about the license terms of certain commercial C++ compilers, do not ask in the SE network, but in a vendor specific forum.