(see next post for the question about makefiles!)

I have this line in ScanScene.h

bool ScanScene(LiDARScan &Scan, LiDARScanner &Scanner, vector<geom_Triangle> &Scene);

and in ScanScene.cpp

bool ScanScene(LiDARScan &Scan, LiDARScanner &Scanner, vector<geom_Triangle> &Scene)
{
...
}

then in another file, I

#include "ScanScene.h";
int main()
{
LiDARScan Scan;
LiDARScanner Scanner;
vector<geom_Triangle> Triangles;
 bool success = ScanScene(Scan, Scanner, Triangles); 
}

But when I compile it says

SingleScan.o(.text+0x339): In function `main':
: undefined reference to `ScanScene(LiDARScan&, LiDARScanner&, std::vector<geom_Triangle, std::allocator<geom_Triangle> >&)'

Can anyone see a problem with this?

Recommended Answers

All 2 Replies

bahhh I didn't have ScanScene.o in my FILELIST in my makefile.

Maybe this is a good second question starter - how do you guys create your makefiles? It seems really easy to forget something like I just did when you have a decent size project.

I have been writing them by hand -

INCLUDES = -I../GeometryLibrary -I../ObjReader

#LIBS = -L../GeometryLibrary -lgeom -L/usr/local/lib -openmp
LIBS = -L../GeometryLibrary -lgeom -lstdc++

FILELIST = SingleScan.o ScanScene.o LiDARScanner.o LiDARScan.o WriteFiles.o ScanPoint.o

EXTERNALFILES = ../ObjReader/ObjReader.o

COMPILER = icc

FLAGS = -fPIC

SingleScan: $(FILELIST)
	$(COMPILER) $(INCLUDES) $(FILELIST) $(EXTERNALFILES) -o SingleScan $(LIBS) $(FLAGS)

#ConcentricScan.o: ConcentricScan.cpp
#	$(COMPILER) -c ConcentricScan.cpp -o ConcentricScan.o $(LIBS) $(FLAGS)

SingleScan.o: SingleScan.cpp
	$(COMPILER) $(INCLUDES) -c SingleScan.cpp -o SingleScan.o $(LIBS) $(FLAGS)

LiDARScan.o: LiDARScan.cpp LiDARScan.h
	$(COMPILER) $(INCLUDES) -c LiDARScan.cpp -o LiDARScan.o $(LIBS) $(FLAGS)

.....

Does that look ok? Or are there better ways to do this?

Eh, I understand. You solved it.

Your makefile looks fine to me. I usually write my makefiles by hand as well.

However, for large projects people will tend to some sort of program like automake or scons or some other like tool to manage all the dependencies in your project and automatically generate the build process for you.

Hope this helps.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.