PDA

View Full Version : Sorry to do this but...I need URGENT help (g++ linking error)




sammich
May 21, 2009, 10:57 AM
Okay, this assignment is due in about 13 hours. It's 2am here, and I'm not planning on sleeping until I can get this running and completed some extensive testing.

It's a small query engine for a uni assignment in Object Oriented Design written in C++. If you have the time to check it out, please do. Download the .zip, unzip and compile it with the command make search.

There are one of two errors that might occur:
a) -l library not found (http://forums.macrumors.com/showthread.php?t=703524) - it's a weird, only happens on my mac error
b) main.cc:(.text._ZN11NodeFactory14getNodeFactoryEv[NodeFactory::getNodeFactory()]+0x4): undefined reference to `NodeFactory::nodeFactory'


If a) does occur, and you've read the post in the link, can you figure it out why it's happening?

and b) which is my REAL problem, I will shower you with /cookies if you solve this :D

PROBLEM SOLVED! /cookieshower



sammich
May 21, 2009, 12:28 PM
Re-uploaded .zip file. I accidentally omitted a .h file somehow...

kpua
May 21, 2009, 12:40 PM
First of all, I don't think you're supposed to have spaces after the -l, -L, or -I flags. So, it should look like -lparser instead of -l parser. Doing this on my machine got past the "library not found" errors.

Another problem is that you have several .o's in the zip file you uploaded that were compiled for Linux:

% file wrappers/RecordFile.o
wrappers/RecordFile.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped

Your Makefile needs to rebuild these natively. (As well as the libparser.a static library)

marksibly
May 21, 2009, 09:46 PM
Hi,

Don't think you've defined the global variable 'nodeFactory' - it's declared in NodeFactory.h here:

static NodeFactory nodeFactory;

...but you probably also need to add this to NodeFactory.cc:

NodeFactory NodeFactory::nodeFactory;

Bye!
Mark

sammich
May 21, 2009, 10:02 PM
Hi,

Don't think you've defined the global variable 'nodeFactory' - it's declared in NodeFactory.h here:

static NodeFactory nodeFactory;

...but you probably also need to add this to NodeFactory.cc:

NodeFactory NodeFactory::nodeFactory;

Bye!
Mark

I posted this question in a programming forums and that's what they suggested, although they said it was conceptually wrong. I might have to go back and reread it.

You still get a /cookie for being first here to point it out :D

sammich
May 21, 2009, 10:03 PM
First of all, I don't think you're supposed to have spaces after the -l, -L, or -I flags. So, it should look like -lparser instead of -l parser. Doing this on my machine got past the "library not found" errors.

Another problem is that you have several .o's in the zip file you uploaded that were compiled for Linux:

% file wrappers/RecordFile.o
wrappers/RecordFile.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped

Your Makefile needs to rebuild these natively. (As well as the libparser.a static library)

Ah...I knew it was some little thing like that. Thanks, that was really annoying. I was thinking if I could get that to link, then I could run locally...alas, I cannot recompile libparser.a since we are given that library.

Stupid me for being so desparate that I didn't clean out the .o files before uploading...

You get a /cookie too :D