Click here to Skip to main content
15,888,984 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Error Pin
Ryuk199028-May-09 17:27
Ryuk199028-May-09 17:27 
GeneralRe: Error Pin
«_Superman_»28-May-09 17:29
professional«_Superman_»28-May-09 17:29 
GeneralRe: Error Pin
Ryuk199028-May-09 17:38
Ryuk199028-May-09 17:38 
GeneralRe: Error Pin
«_Superman_»28-May-09 17:45
professional«_Superman_»28-May-09 17:45 
GeneralRe: Error Pin
Chandrasekharan P28-May-09 17:48
Chandrasekharan P28-May-09 17:48 
QuestionInsertion and removal of CD/DVD Pin
siva45528-May-09 16:49
siva45528-May-09 16:49 
AnswerRe: Insertion and removal of CD/DVD Pin
Garth J Lancaster28-May-09 18:24
professionalGarth J Lancaster28-May-09 18:24 
GeneralRe: Insertion and removal of CD/DVD Pin
«_Superman_»28-May-09 19:41
professional«_Superman_»28-May-09 19:41 
QuestionRe: Insertion and removal of CD/DVD Pin
Randor 28-May-09 21:47
professional Randor 28-May-09 21:47 
GeneralWant to learn Pin
Learning CPP language28-May-09 11:51
Learning CPP language28-May-09 11:51 
GeneralRe: Want to learn Pin
David Crow28-May-09 16:30
David Crow28-May-09 16:30 
Questionbind() to specific network interface before connect() Pin
Alexander M.,28-May-09 10:37
Alexander M.,28-May-09 10:37 
AnswerRe: bind() to specific network interface before connect() Pin
Stuart Dootson28-May-09 11:09
professionalStuart Dootson28-May-09 11:09 
GeneralRe: bind() to specific network interface before connect() Pin
Alexander M.,28-May-09 12:45
Alexander M.,28-May-09 12:45 
GeneralRe: bind() to specific network interface before connect() Pin
Alexander M.,29-May-09 6:31
Alexander M.,29-May-09 6:31 
GeneralRe: bind() to specific network interface before connect() Pin
Stuart Dootson29-May-09 13:18
professionalStuart Dootson29-May-09 13:18 
QuestionStatic Library linking problem: Archive has no index; run ranlib to add one Pin
thelonesquirrely28-May-09 8:26
thelonesquirrely28-May-09 8:26 
AnswerRe: Static Library linking problem: Archive has no index; run ranlib to add one Pin
Single Step Debugger28-May-09 10:03
Single Step Debugger28-May-09 10:03 
AnswerRe: Static Library linking problem: Archive has no index; run ranlib to add one Pin
Stuart Dootson28-May-09 11:06
professionalStuart Dootson28-May-09 11:06 
GeneralRe: Static Library linking problem: Archive has no index; run ranlib to add one Pin
thelonesquirrely28-May-09 14:06
thelonesquirrely28-May-09 14:06 
GeneralRe: Static Library linking problem: Archive has no index; run ranlib to add one Pin
Stuart Dootson28-May-09 14:47
professionalStuart Dootson28-May-09 14:47 
If you're building a library with make (I'm talking Gnu make here), the approach I've used in the past is just to specify the dependency between the archive and its members and let make work out how to build from the built-in rules, customising the build where necessary using the compiler flag variables.

Consider this situation - I have a library, libtest.a, containing b.o (built from b.c) and c.o (built from c.cpp). Both files are dependent on the header file test.h.

This library is used to build an executable a, which has a main file a.o (built from a.c). a.o is also dependent on test.h

This makefile expresses these dependencies relatively minimally, and also modifies the standard compilation commands (turning on optimisations):

EXE_OBJS = a.o
LIB_OBJS = b.o c.o
LIB_ITEMS = $(foreach dir, $(LIB_OBJS), libtest.a($(dir)))
CFLAGS=-O2
CXXFLAGS=-O2

a : $(EXE_OBJS)
	gcc -o a $< -ltest
a : libtest.a
$(EXE_OBJS) : test.h

libtest.a : $(LIB_ITEMS)
$(LIB_OBJS) : test.h


EXE_OBJS is a list of the objects linked directly into the executable. LIB_OBJS is a list of the object files included in the archive. LIB_ITEMS is a simple transformation of LIB_OBJS into archive members (LIB_ITEMS will be libtest.a(b.0) libtest.a(c.o)).

The rules with commands express the primary dependencies, but the other rules also cause rule commands to be executed. That means that if I modify b.c, the libtest.a and a rules will be invoked (b.c => b.o => libtest.a(b.o) => libtest.a => a), so re-compiling b.c into b.o, inserting b.o into libtest.a and re-linking a.

Similarly, if I modify test.h, the rules mean that all the objects will be re-compiled.

It might be a little more involved, but I find it lets me express the dependencies more correctly (and I can use $< without worrying about including files that shouldn't be Smile | :) )

Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

QuestionRead an IGES (Initial Graphics Exchange Specification) File uaing C++ Pin
raesa28-May-09 2:55
raesa28-May-09 2:55 
AnswerRe: Read an IGES (Initial Graphics Exchange Specification) File uaing C++ Pin
led mike28-May-09 4:33
led mike28-May-09 4:33 
GeneralRe: Read an IGES (Initial Graphics Exchange Specification) File uaing C++ Pin
raesa28-May-09 18:27
raesa28-May-09 18:27 
AnswerRe: Read an IGES (Initial Graphics Exchange Specification) File uaing C++ Pin
Stuart Dootson28-May-09 8:01
professionalStuart Dootson28-May-09 8:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.