Kirjoittaja Aihe: caelinuxilla gcc - kääntäjässä ongelma (c++)  (Luettu 2405 kertaa)

eelis

  • Käyttäjä
  • Viestejä: 187
    • Profiili
Terve.

Anteeksi, että vaivaan eri distribuution ongelmalla, mutta caelinuxin omilla
sivuilla on joitakin kummallisia ongelmia enkä pysty kirjoittamaan kysymystäni sinne
ja ajattelin täällä olevan asiantuntevaa porukkaa. Eli ongelma esiintyy kun
yritän kääntää helloworld.cpp:tä:

Koodia: [Valitse]
[caelinux@lenovo-7fd9a745 ~]$ gcc helloworld.cpp -o helloworld
In file included from /opt/OpenFOAM/linux/gcc-4.2.1/bin/../lib/gcc/i686-pc-linux-gnu/4.2.1/../../../../include/c++/4.2.1/backward/iostream.h:31,
                 from helloworld.cpp:1:
/opt/OpenFOAM/linux/gcc-4.2.1/bin/../lib/gcc/i686-pc-linux-gnu/4.2.1/../../../../include/c++/4.2.1/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
helloworld.cpp:7:2: warning: no newline at end of file
/home/caelinux/tmp/cc8usm43.o: In function `std::__verify_grouping(char const*, unsigned int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
helloworld.cpp:(.text+0xe): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::size() const'
helloworld.cpp:(.text+0x59): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator[](unsigned int) const'
helloworld.cpp:(.text+0x97): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator[](unsigned int) const'
helloworld.cpp:(.text+0xdf): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator[](unsigned int) const'
/home/caelinux/tmp/cc8usm43.o: In function `main':
helloworld.cpp:(.text+0x128): undefined reference to `std::cout'
helloworld.cpp:(.text+0x12d): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
/home/caelinux/tmp/cc8usm43.o: In function `__static_initialization_and_destruction_0(int, int)':
helloworld.cpp:(.text+0x15d): undefined reference to `std::ios_base::Init::Init()'
/home/caelinux/tmp/cc8usm43.o: In function `__tcf_0':
helloworld.cpp:(.text+0x1aa): undefined reference to `std::ios_base::Init::~Init()'
/home/caelinux/tmp/cc8usm43.o:(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status

Osaako joku kertoa mitä tämä tarkoittaa ?


mgronber

  • Käyttäjä
  • Viestejä: 1458
    • Profiili
Vs: caelinuxilla gcc - kääntäjässä ongelma (c++)
« Vastaus #1 : 07.12.07 - klo:11.48 »
Osaako joku kertoa mitä tämä tarkoittaa ?

Käytät väärää kääntäjää. Komennolla gcc käännetään C-ohjelmia. C++ käännetään komennon g++ avulla.

eelis

  • Käyttäjä
  • Viestejä: 187
    • Profiili
Vs: caelinuxilla gcc - kääntäjässä ongelma (c++)
« Vastaus #2 : 07.12.07 - klo:11.52 »
ahaa, sehän selittääkin paljon...
Kiitoksia!

-Eelis Takala-