1

I just started using SciTE and I really like it, but at the moment I'm having a bit of a problem.

When I make a simple "hello world" with just one file everything works just fine. But when I start to add other files I get problems linking causing undefined references.

g++ $(ccopts) -c $(FileNameExt) -o $(FileName).o

That's the command in my cpp.properties. Everything is at the default.

I have main.cpp and an a.cpp and a.h.

How can I configure this to account for multiple files?

SpaceFace
  • 1,492
  • 3
  • 15
  • 29

1 Answers1

2

To compile multiple file do this

g++ main.cpp -o main.o
g++ a.cpp    -o a.o
g++ main.o a.o -o program

then run with

./program

I simple make file might look like

Makefile

CC=g++

all: program

program: main.o a.o
    $(CC) $< -o $@

%.o: %.cpp
    $(CC) $< -o $@
111111
  • 15,686
  • 6
  • 47
  • 62