Re: "fstream: No such file or directory" but it is present

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 25, 2011 at 11:46:08AM -0700, Mahmood Naderan wrote:
> >Either rename it or compile with g++, see the manual
>  
> The make file is generated with a configure script. If I rename to .C I get this error:
>  
> make[2]: *** No rule to make target `bpred.c', needed by `bpred.o'.  Stop.
> 
> On the other hand, I don't know how to tell makefile to compile *only* bpred.c with g++.

you can either adding a rule which states "bpred.o is generated from
"bpred.C", something like

bpred.o: bpred.C
  $(CXX) $(CXXFLAGS) -o $@ $^

but maybe you need more flags, files, ...?

Or you can change the makefile to use g++ instead of gcc:
bpred.o: bpred.c
  $(CXX) $(CXXFLAGS) -o $@ $^

"g++" automatically compiles its .c-files as being C++.

Or you can tell gcc to use C++:

bpred.o: bpred.c
  $(CC) $(CFLAGS) -x c++ -o $@ $^

(the parameter "-x c++" tells gcc to compile a C++-file.

Axel


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux