HaggarTheHorrible
HaggarTheHorrible

Reputation: 7403

How to set C++ environment variable in Linux ubuntu?

I just installed Ubuntu on my Virtualbox on Windows.

I was trying to install cmake and the installation guide in the cmake website asked me to do the following steps

./bootstrap
make
make install

But when I just did the ./bootstrap command I get the following list of errors, can anyone suggest me how I can set the C++ compiler on my system. As I just installed Ubuntu perhaps the C++ is not set currently.

Kindly help.


CMake 2.8.1, Copyright 2000-2009 Kitware, Inc.
C compiler on this system is: cc

Error when bootstrapping CMake:
Cannot find appropriate C++ compiler on this system.
Please specify one using environment variable CXX.
See cmake_bootstrap.log for compilers attempted.

Log of errors: /home/vikboy/Downloads/cmake-2.8.1/Bootstrap.cmk/cmake_bootstrap.log

Upvotes: 2

Views: 34924

Answers (2)

Kemin Zhou
Kemin Zhou

Reputation: 6891

I am having the same problem. Even I defined the CXX environmental variable correctly.

$CXX --version g++ (GCC) 5.3.0 Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I looked at the log file of the ./configure output: Bootstrap.cmk/cmake_bootstrap.log

class NeedCXX
{
public:
  NeedCXX() { this->Foo = 1; }
  int GetFoo() { return this->Foo; }
private:
  int Foo;
};
int main()
{
  NeedCXX c;
#ifdef TEST3
  cout << c.GetFoo() << endl;
#else
  std::cout << c.GetFoo() << std::endl;
#endif
  return 0;
}

/usr/bin/ld: cannot find -lgcc_s collect2: error: ld returned 1 exit status Test failed to compile Try: /usr/local/bin/g++ Line: /usr/local/bin/g++ -DTEST2 cmake_bootstrap_18998_test.cxx -o cmake_bootstrap_18998_test ---------- file -----------------------

The main problem is that the programmer who wrote the test did not include the include path -L/PATH/to/C++/header, that on my computer is /usr/local/include/c++/5.3.0

This path should be included in the auto probing or should be an option in the configure program. I hope the cmake developers can see this message and change the auto detect a little bit.

Or I may be wrong.

Upvotes: 1

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798744

Install the build-essential packages via apt.

sudo apt-get install build-essential

Upvotes: 11

Related Questions