Note that there are some explanatory texts on larger screens.

plurals
  1. POstring to float in gcc
    primarykey
    data
    text
    <pre><code>#include &lt;iostream&gt; #include &lt;stdlib.h&gt; using namespace std; int main() { string a; cin&gt;&gt;a; float v=strtof(a.c_str(),NULL); cout&lt;&lt;v; } </code></pre> <p>The above code works in g++ compiler. But in gcc its reporting following error. </p> <pre><code>/tmp/ccz60ueB.o: In function `main': test1.cpp:(.text+0x12): undefined reference to `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::basic_string()' test1.cpp:(.text+0x21): undefined reference to `std::cin' test1.cpp:(.text+0x26): undefined reference to `std::basic_istream&lt;char, std::char_traits&lt;char&gt; &gt;&amp; std::operator&gt;&gt;&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;(std::basic_istream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;, std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;&amp;)' test1.cpp:(.text+0x32): undefined reference to `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::c_str() const' test1.cpp:(.text+0x55): undefined reference to `std::cout' test1.cpp:(.text+0x5a): undefined reference to `std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;::operator&lt;&lt;(float)' test1.cpp:(.text+0x66): undefined reference to `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::~basic_string()' test1.cpp:(.text+0x81): undefined reference to `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::~basic_string()' /tmp/ccz60ueB.o: In function `__static_initialization_and_destruction_0(int, int)': test1.cpp:(.text+0xac): undefined reference to `std::ios_base::Init::Init()' test1.cpp:(.text+0xb1): undefined reference to `std::ios_base::Init::~Init()' /tmp/ccz60ueB.o:(.eh_frame+0x13): undefined reference to `__gxx_personality_v0' collect2: ld returned 1 exit status </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload