G ++ compiler: -s option is deprecated and ignored by C ++

I am trying to compile and skip a very simple C ++ program with the g ++ compiler (4.6.0 on Mac OSX). But when compiling, I get a warning.


source:

#include </usr/local/Cellar/gcc/4.6.0/gcc/include/c++/4.6.0/iostream>

int main(){
    std::cout << ("Hello World\n") ;
}

Terminal Code:

g++ hello.cc -Wall -std=c++0x -s
    /* or an alternative: */
g++ hello.cc -Wall -std=c++0x -o test -Wl,-s

Compiler Warning:

ld: warning: option -s is obsolete and being ignored

Does anyone know about this strange warning?

Edit:

It is strange that the size decreases when using the -s flag, decreases from 9.216 to 9.008.

However, when I use the following, the size decreases to 8,896 bytes.

cp hello hello_stripped
strip hello_stripped
+5
source share
2 answers

ld, gcc g++. ( gcc g++ - , , .)

gcc -s , gcc 4.6.1 manual; , MacOS gcc .

GNU (GNU ld) - -s . MacOS ( ld) , MacOS ld manual:

-s , .      .     .

MacOS gcc, GNU gcc, "-s".

+5

-, -s . strip.

+2

All Articles