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

C / C++ / MFC

 
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 
AnswerRe: Read an IGES (Initial Graphics Exchange Specification) File uaing C++ Pin
Maximilien28-May-09 11:09
Maximilien28-May-09 11:09 
QuestionTaget operating system Pin
Gagnon Claude28-May-09 2:14
Gagnon Claude28-May-09 2:14 
AnswerRe: Taget operating system Pin
Rajesh R Subramanian28-May-09 2:17
professionalRajesh R Subramanian28-May-09 2:17 
AnswerRe: Taget operating system Pin
Single Step Debugger28-May-09 4:33
Single Step Debugger28-May-09 4:33 
QuestionBuild Application in VC++ Pin
anassamar28-May-09 2:06
anassamar28-May-09 2:06 
AnswerRe: Build Application in VC++ Pin
Chandrasekharan P28-May-09 2:11
Chandrasekharan P28-May-09 2:11 
GeneralRe: Build Application in VC++ Pin
anassamar28-May-09 3:58
anassamar28-May-09 3:58 
AnswerRe: Build Application in VC++ Pin
Naveen28-May-09 2:11
Naveen28-May-09 2:11 
AnswerRe: Build Application in VC++ Pin
Rajesh R Subramanian28-May-09 2:12
professionalRajesh R Subramanian28-May-09 2:12 
AnswerRe: Build Application in VC++ Pin
hourui28-May-09 17:07
hourui28-May-09 17:07 
QuestionHow can i close messagebox without clicking a button? [modified] Pin
Le@rner28-May-09 0:56
Le@rner28-May-09 0:56 
AnswerRe: How can i close messagebox without clicking a button? Pin
Rajesh R Subramanian28-May-09 1:00
professionalRajesh R Subramanian28-May-09 1:00 
AnswerRe: How can i close messagebox without clicking a button? Pin
Chandrasekharan P28-May-09 1:04
Chandrasekharan P28-May-09 1:04 

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.