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++.
In today's update *.cc has been added to the list of files recognised as c++ file. This has been done to ask C::B to use g++ for *.cc files.
I believe this is not affecting you.
Anyway you can ask C::B to use g++. Right click on file and click Properties and go to Advanced tab. Now change the compiler variable to CPP.
Thank your reply for my problem. but got the error too.
I've do some change as you mentioned , my operation is
1),check
the compiler variable, it has been set as [CPP]
2), change file name : main.cpp -> main.cc, and modify the *.cbp file to include new file.
After these, I got error message:
obj\Debug\main.o:: In function `ZSt3minIjERKT_S2_S2_':
c:\SRCTemp\CPP\newCC\main.cc:(.text+0xd):: undefined reference to `std::string::size() const'
c:\SRCTemp\CPP\newCC\main.cc:(.text+0x60):: undefined reference to `std::string::operator[](unsigned int) const'
c:\SRCTemp\CPP\newCC\main.cc:(.text+0x9f):: undefined reference to `std::string::operator[](unsigned int) const'
c:\SRCTemp\CPP\newCC\main.cc:(.text+0xce):: undefined reference to `std::string::operator[](unsigned int) const'
obj\Debug\main.o:: In function `main':
c:\SRCTemp\CPP\newCC\main.cc:20: undefined reference to `std::cout'
c:\SRCTemp\CPP\newCC\main.cc:20: 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.cc:20: 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.cc:20: 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 ===
And after I comment out all the lines relating to <iostream>, and add one test class, compilation is OK.
so I think , my description in previous is not right. All these error message because of the std::iostream,any hint?
my test code as following:
//#include <iostream>
using namespace std;
class AAA{
public:
AAA():m_i(0){
}
void testone(int i){
this->m_i = i;
}
private:
int m_i;
};
int main()
{
AAA aa;
aa.testone(99);
// cout << "Hello world!" << endl;
return 0;
}
? really want to know what's happened!