1

I keep getting a bunch of compile messages when I try and compile a class.

I was wondering if this method I'm using to compile using terminal is correct.

So I have the files a.cpp, aImp.cpp & a.h

I create .o (object) file for aImp.cpp with

cc -c aImp.cpp

Afterwards

cc a.cpp aImp.o
Pyrons
  • 325
  • 1
  • 5
  • 12
  • 1
    possible duplicate of [Using G++ to compile multiple .cpp and .h files](http://stackoverflow.com/questions/3202136/using-g-to-compile-multiple-cpp-and-h-files) – CrApHeR Mar 25 '15 at 03:16
  • 1
    `cc` is the Unix system `C` compiler (`gcc` on Linux), you need `c++` (or `g++` on Linux). – Galik Mar 25 '15 at 03:30
  • but I am converting my implementation into a object file. Nothing seems to happen when I use g++ -o ... – Pyrons Mar 25 '15 at 03:36
  • You don't "compile classes" in C++, by the way - you compile files. – user253751 Mar 25 '15 at 03:56
  • how would i compile a object file with the main file – Pyrons Mar 25 '15 at 04:05

1 Answers1

0

You can use the following syntax

g++ -Wall aImp.cpp a.cpp -o app

Hope this helps

CrApHeR
  • 2,595
  • 4
  • 25
  • 40