[antlr-interest] More VC++ 6 Confusion (MFC libs)

Chris.Kaiser at peoplefirst.com Chris.Kaiser at peoplefirst.com
Mon Dec 31 09:16:07 PST 2001


You'll probably need to statically link both MFC and the antlr libs.

And possibly ignore the default lib: LIBC.lib

Yer mileage may vary...

> -----Original Message-----
> From: kemmerzehl [mailto:malitrait at start.com.au]
> Sent: Sunday, December 30, 2001 4:42 AM
> To: antlr-interest at yahoogroups.com
> Subject: [antlr-interest] More VC++ 6 Confusion (MFC libs)
> 
> 
> Hi,
>   I do hate to add to your list of confused VC++ user messages but 
> I've followed the steps from your existing discussions/literature and 
> I'm still having some problems. It appears this particular issue has 
> not yet been addressed although it seems like it would be a 
> common problem so I do apologise if I've missed something.
>   Anyway, here's the problem. Quite simply, the ANTLR and MFC libs 
> just wont work for me together - I get link errors. I've built my 
> ANTLR lib files according to JSRS's 'How To', and by themselves they 
> work well. If I use VC++ to create a 'Win32 Console Application' and 
> do NOT include MFC support, then add the generated calc example files 
> and add the ANTLR library, everything compiles links and runs fine. 
> If, however, I do the same thing only I DO include MFC support (and 
> remembering to take off the /Yu"stdafx.h" flag), I get the following 
> link errors:
> 
> LIBC.lib(cfout.obj) : error LNK2005: ___dtold already defined in 
> libcmt.lib(cfout.obj)
> LIBC.lib(crt0dat.obj) : error LNK2005: __cinit already defined in 
> libcmt.lib(crt0dat.obj)
> LIBC.lib(crt0dat.obj) : error LNK2005: _exit already defined in 
> libcmt.lib(crt0dat.obj)
> LIBC.lib(crt0dat.obj) : error LNK2005: __exit already defined in 
> libcmt.lib(crt0dat.obj)
> LIBC.lib(crt0dat.obj) : error LNK2005: __cexit already defined in 
> libcmt.lib(crt0dat.obj)
> ..etc.
> 
>   One rather odd thing is that I can get the _debug_ build to work
> (for the calc example) if I link statically to MFC and use the /MT 
> flag instead of /MTd(default for debug builds). These flags represent 
> the "Multithreaded" and "Debug Multithreaded" runtime libraries, 
> available in the "Code Generation" dropdown section of the "C++" tab 
> in Project -> Settings. This however does not fix the problem for the 
> release build, I even tried using JSRS's debug version of the ANTLR 
> library with the release build (using /MT) and I still got link 
> errors. Also, I could not get rid of the link errors at all for the 
> project im working on (with either build).
>   All of this is purely trial and error for me as I've never had to 
> deal with third-party libraries before. I hope some of the info I've 
> provided can be of use and that somebody out there has experienced 
> this linking problem before and knows how to fix it. Either way, I'm 
> going to keep ripping my hair out trying to fix it, if I find a 
> solution I'll post it.
> 
> Thanks,
> -Kemmerzehl
> 
> 
>  
> 
> Your use of Yahoo! Groups is subject to 
> http://docs.yahoo.com/info/terms/ 
> 
> 

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list