suma
suma

Reputation: 728

unable to run cpp file using scons

i am trying to compile a c++ program in scons. the scons works fine for c program but for c++ its giving the following error. please can anybody help me about this, who knows about this?

first.cpp

#include <iostream>
int main()
{
    std::cout << "hellooo" << std::endl;
    return 0;
}

SConstructor

Program('first','first.cpp')

the error:

scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
o first.o -c first.cpp
sh: o: command not found
o first.exe first.o
sh: o: command not found
scons: done building targets.

what could be the problem in this?

Upvotes: 3

Views: 1820

Answers (1)

Brady
Brady

Reputation: 10357

You dont have a compiler for C++ installed, or at least SCons cant find it. Although you would expect SCons to explicitly tell you it cant find the compiler, I think what actually happens is it has a Construction Variable for the compiler that is actually empty, and it uses that to create the command line.

If you do indeed have it installed, you can fix this problem as follows:

env = Environment()
env.Replace(CXX = "/path/to/the/c++/compiler")

Upvotes: 3

Related Questions