Click here to Skip to main content
15,911,132 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: multiple active windows in MDI? Pin
Jose Cruz4-Jul-01 11:35
Jose Cruz4-Jul-01 11:35 
GeneralGetCurrentDirectory Pin
3-Jul-01 10:45
suss3-Jul-01 10:45 
GeneralRe: GetCurrentDirectory Pin
Ghazi H. Wadi3-Jul-01 10:50
Ghazi H. Wadi3-Jul-01 10:50 
GeneralWord and WM_VSCROLL Pin
BobMatura3-Jul-01 10:08
BobMatura3-Jul-01 10:08 
Questionhow to include source code Pin
uma3-Jul-01 9:26
uma3-Jul-01 9:26 
AnswerRe: how to include source code Pin
Jonathon Lockett3-Jul-01 12:54
Jonathon Lockett3-Jul-01 12:54 
GeneralSoundBuffer problems. Pin
Daniel Selberg3-Jul-01 8:27
Daniel Selberg3-Jul-01 8:27 
Generalquestion about linking to a static library Pin
3-Jul-01 8:25
suss3-Jul-01 8:25 
Netmeisters,

I am having a great deal of difficulty doing something with VC++ which
should be very simple, and would appreciate your help. All I would
like to do is, create a static library and link an application to it
(as I said, it should be very simple...). The static library contains
C type functions, rather than C++ classes.

I create the library, we'll call it foo, by selecting New Project |
Win32 static library, and leaving the two options (MFC support and
precompiled headers) unchecked. Then I create two files, foo.h and
foo.c, in the library. The first just contains

void bar(void);

and the second
void bar() { }

This compiles OK, creating the file foo.lib. Now if I want to use
bar() in an application, I should just have to include foo.h and
specify a link to foo.lib. I do the latter by using Project | Add to
Project | Files, after which foo.lib shows up in the pane on the left
under Resources. When I compile the application, however, the include
file gets read (because there are no complaints about bar being
undefined), but the linker complains that bar is an unresolved symbol.

I have example code from a book showing how to do this, and the code
compiles just fine. Also, if I add my function bar() to the example
code, everything works as expected. If I declare bar() in my include
file, but define it in the example library, everything works fine. But
for some reason I can't define it in my own library; linking just
doesn't work.

There must be some straightforward way of making all this work, but
for the life of me I can't figure it out. This kind of thing is real
simple under Unix, don't know what is going wrong under Windows. Would
very much appreciate some assistance.

Thanks,

Matthew Fleming
------------------------------------------------------------------------------
Matthew G. Fleming, MD phone : 414.456.4072
Associate Professor fax : 414.456.6518
Department of Dermatology s-mail: Dept. of Dermatology
Medical College of Wisconsin Medical College of Wisconsin
MFRC Room 4061
e-mail: mgf@mcw.edu Milwaukee, WI 53226-4810
------------------------------------------------------------------------------

GeneralRe: question about linking to a static library Pin
Stan Shannon3-Jul-01 8:52
Stan Shannon3-Jul-01 8:52 
GeneralRe: question about linking to a static library Pin
markkuk3-Jul-01 21:07
markkuk3-Jul-01 21:07 
GeneralAre you a proffesional you should see this!! Pin
Rickard Andersson203-Jul-01 8:22
Rickard Andersson203-Jul-01 8:22 
GeneralRe: Are you a proffesional you should see this!! Pin
Jonathon Lockett3-Jul-01 12:55
Jonathon Lockett3-Jul-01 12:55 
GeneralRe: Are you a proffesional you should see this!! Pin
3-Jul-01 22:16
suss3-Jul-01 22:16 
QuestionTad control.......?? Pin
Rickard Andersson203-Jul-01 7:32
Rickard Andersson203-Jul-01 7:32 
GeneralODBC gurus please Pin
3-Jul-01 6:49
suss3-Jul-01 6:49 
GeneralRe: ODBC gurus please Pin
Tomasz Sowinski3-Jul-01 9:59
Tomasz Sowinski3-Jul-01 9:59 
GeneralRe: ODBC gurus please Pin
3-Jul-01 22:57
suss3-Jul-01 22:57 
GeneralDumb Question Pin
RobJones3-Jul-01 5:21
RobJones3-Jul-01 5:21 
GeneralRe: Dumb Question Pin
Ghazi H. Wadi3-Jul-01 10:53
Ghazi H. Wadi3-Jul-01 10:53 
GeneralRe: Dumb Question Pin
3-Jul-01 21:16
suss3-Jul-01 21:16 
QuestionSend information from a MFC to another MFC??? Pin
3-Jul-01 4:57
suss3-Jul-01 4:57 
AnswerRe: Send information from a MFC to another MFC??? Pin
3-Jul-01 5:19
suss3-Jul-01 5:19 
GeneralRe: Send information from a MFC to another MFC??? Pin
3-Jul-01 5:44
suss3-Jul-01 5:44 
GeneralRe: Send information from a MFC to another MFC??? Pin
RobJones3-Jul-01 6:07
RobJones3-Jul-01 6:07 
GeneralRe: Send information from a MFC to another MFC??? Pin
3-Jul-01 23:16
suss3-Jul-01 23:16 

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.