programer8472
programer8472

Reputation: 3

Basic Linker Script

I'm trying to clean up the commandline required to build my program. Right now, the command in my makefile looks like this.

gcc -o myapp myapp.c liba.a -lPocoFoundation -lPocoNet -lPocoUtil -lstdc++

And I have other shared libraries to add to it!

I believe a linker script would clean things up nicely. However, all the examples I've seen of linker scripts talk about memory management, requiring values which I do not know how to set.

If you would write a very basic linker script that included the libraries noted above, I would be most grateful!

Thank you so much in advance for your time.

Upvotes: 0

Views: 304

Answers (2)

user149341
user149341

Reputation:

To echo what nneonneo said in a comment:

A linker script will not do what you want here. Linker scripts are used to configure how the linker generates output, e.g. where different types of code and data are located in memory. There is almost never any reason to write or customize a linker script outside of embedded/low-level software development.

What you want is a Makefile, as explained by jforberg.

Upvotes: 2

jforberg
jforberg

Reputation: 6752

In your Makefile:

LDLIBS = -la -lPocoFoundation -lPocoNet -lPocoUtil -lstd++
LDFLAGS = -L.

all: myapp

And then just run make.

Upvotes: 2

Related Questions