Author Topic: How to change compiler from gcc to g++  (Read 14295 times)

RobinMin

  • Guest
How to change compiler from gcc to g++
« on: August 06, 2007, 06:18:51 am »
I am sorry for report this in this topic, but I got the problem after install this night build version.

My problem is , I have some C++ codes compiled pass by previous version, but after today's update, C::B using gcc to compile the C++ code automatically , but not the g++.
the code like following
Code
#include <iostream>

using namespace std;

int main()
{
    cout << "Hello world!" << endl;
    return 0;
}

And I got the following error message:
Code
:: === newCC, Debug ===
obj\Debug\main.o:: In function `ZSt17__verify_groupingPKcjRKSs':
\usr\lib\gcc\i686-pc-cygwin\3.4.4\include\c++\bits\locale_facets.tcc:2498: undefined reference to `std::string::size() const'
\usr\lib\gcc\i686-pc-cygwin\3.4.4\include\c++\bits\locale_facets.tcc:2507: undefined reference to `std::string::operator[](unsigned int) const'
\usr\lib\gcc\i686-pc-cygwin\3.4.4\include\c++\bits\locale_facets.tcc:2509: undefined reference to `std::string::operator[](unsigned int) const'
\usr\lib\gcc\i686-pc-cygwin\3.4.4\include\c++\bits\locale_facets.tcc:2512: undefined reference to `std::string::operator[](unsigned int) const'
obj\Debug\main.o:: In function `main':
C:\SRCTemp\CPP\newCC\main.cpp:7: undefined reference to `std::cout'
C:\SRCTemp\CPP\newCC\main.cpp:7: 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*)'
C:\SRCTemp\CPP\newCC\main.cpp:7: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)'
C:\SRCTemp\CPP\newCC\main.cpp:7: undefined reference to `std::ostream::operator<<(std::ostream& (*)(std::ostream&))'
obj\Debug\main.o:: In function `Z41__static_initialization_and_destruction_0ii':
\usr\lib\gcc\i686-pc-cygwin\3.4.4\include\c++\iostream:77: undefined reference to `std::ios_base::Init::Init()'
\usr\lib\gcc\i686-pc-cygwin\3.4.4\include\c++\iostream:77: undefined reference to `std::ios_base::Init::~Init()'
:: === Build finished: 10 errors, 0 warnings ===

the most unfortunately, I can not found one way to change the compiler from gcc to g++, anybody can give me the solution or any hint?

my environment is cgywin + XP + gcc.

any help will be appreciated. thx

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: How to change compiler from gcc to g++
« Reply #1 on: August 06, 2007, 09:03:29 am »
That can be changed under the compiler settins ("toolchain executables" tab).
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

gringo

  • Guest
Re: How to change compiler from gcc to g++
« Reply #2 on: August 06, 2007, 09:08:25 am »
Open the Compiler/Debugger settings dialog ("Settings"->"Compiler and Debugger"). There is a tab named "Toolchain executables", where you can find the executables which are use for compiling/linking. Make sure, that in the field "C++ compiler" g++ is selected. That should do it.

Regard,
Gringo

RobinMin

  • Guest
Re: How to change compiler from gcc to g++
« Reply #3 on: August 08, 2007, 04:12:11 am »
Thanks you guys reply.

It is ok, now.