www.digitalmars.com         C & C++   DMDScript  

c++ - dmc and expat

reply adi <adi_member pathlink.com> writes:
I've tried to use expat with digital mars compiler, but it seems not to
recognise the libraries.
I've used the implib utility.
The command line looks like this:

dmc -L/libexpat main.cpp

The code compiles well, but when i try to link it, i have the following
messages:

link main,,,user32+kernel32/noi/libexpat;

OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

OPTLINK : Warning 9: Unknown Option : LIBEXPAT
main.obj(main) 
Error 42: Symbol Undefined _XML_ParserFree
main.obj(main) 
Error 42: Symbol Undefined _XML_GetCurrentLineNumber
main.obj(main) 
Error 42: Symbol Undefined _XML_ErrorString
main.obj(main) 
Error 42: Symbol Undefined _XML_GetErrorCode
main.obj(main) 
Error 42: Symbol Undefined _XML_Parse
main.obj(main) 
Error 42: Symbol Undefined _XML_SetCharacterDataHandler
main.obj(main) 
Error 42: Symbol Undefined _XML_SetElementHandler
main.obj(main) 
Error 42: Symbol Undefined _XML_SetUserData
main.obj(main) 
Error 42: Symbol Undefined _XML_ParserCreate

--- errorlevel 9

Any ideea?
Maybe i do not use the proper parameters on the command line?

Regards
Adi
May 12 2004
next sibling parent reply "W這dzimierz Skiba" <abx abx.art.pl> writes:
adi <adi_member pathlink.com> wrote in 
news:c7t8ec$1do6$1 digitaldaemon.com:
 I've tried to use expat with digital mars compiler, but it seems not to
 recognise the libraries.
 [...]
 Any ideea?
 Maybe i do not use the proper parameters on the command line?

I do not know about your particular problem but if you are interested wxWidgets build expat in their source tree with DMC without problems. Hope this helps, ABX
May 12 2004
parent reply adi <adi_member pathlink.com> writes:
Thanks for your fast reply.

Unfortunatelly I have to build a console aplication, so I would rather not
include wx in my program.

The fact is that I'm quite new to c++ and I don't know very much about linking
and other stuff.
This solution was allready built (also by me) using mingw, but I would like to
use digital mars because of its qualities.

Thanks anyway

In article <c7tdqq$1los$1 digitaldaemon.com>, W這dzimierz Skiba says...
adi <adi_member pathlink.com> wrote in 
news:c7t8ec$1do6$1 digitaldaemon.com:
 I've tried to use expat with digital mars compiler, but it seems not to
 recognise the libraries.
 [...]
 Any ideea?
 Maybe i do not use the proper parameters on the command line?

I do not know about your particular problem but if you are interested wxWidgets build expat in their source tree with DMC without problems. Hope this helps, ABX

May 12 2004
parent reply "W這dzimierz Skiba" <abx abx.art.pl> writes:
adi <adi_member pathlink.com> wrote in
news:c7thhl$1rrj$1 digitaldaemon.com: 
 Unfortunatelly I have to build a console aplication, so I would rather
 not include wx in my program.

I didn't mean building your application with wxWidgets but looking into compilation settings used there during building expat part. But since you probably have wrong idea of what wxWidgets is, I have to correct you that you can succesfully build console programs with it. wxWidgets is toolkit builded from a few libraries. wxBase and wxNet are supposed to fine work in consoles and there is wxAppConsole class for such purposes. Look at overview: http://www.wxwidgets.org/manuals/2.5.1/wx_librarieslist.html#librarieslist
 The fact is that I'm quite new to c++ and I don't know very much about
 linking and other stuff.

Then wxWidgets route can be interesting solution for you in the future because it delivers ready build system. ABX
May 13 2004
parent adi <adi_member pathlink.com> writes:
Ok,
Thanks for your reply again,
I will certainly look over wxWidgetds. I believed it was all about GUI, but i
guess i was wrong.

Adi

In article <c7vlej$2912$1 digitaldaemon.com>, W這dzimierz Skiba says...
adi <adi_member pathlink.com> wrote in
news:c7thhl$1rrj$1 digitaldaemon.com: 
 Unfortunatelly I have to build a console aplication, so I would rather
 not include wx in my program.

I didn't mean building your application with wxWidgets but looking into compilation settings used there during building expat part. But since you probably have wrong idea of what wxWidgets is, I have to correct you that you can succesfully build console programs with it. wxWidgets is toolkit builded from a few libraries. wxBase and wxNet are supposed to fine work in consoles and there is wxAppConsole class for such purposes. Look at overview: http://www.wxwidgets.org/manuals/2.5.1/wx_librarieslist.html#librarieslist
 The fact is that I'm quite new to c++ and I don't know very much about
 linking and other stuff.

Then wxWidgets route can be interesting solution for you in the future because it delivers ready build system. ABX

May 17 2004
prev sibling next sibling parent reply -scooter- <scottm cs.ucla.edu> writes:
Try putting the library after main.cpp:

dmc main.cpp libexpat.lib

You cannot fail if you assume that a linker (including the GNU and Linux and 
FreeBSD linkers) resolves unknown symbols in one pass: it resolves unknown 
symbols from each file it processes from left to right on the command line.

adi wrote:

 I've tried to use expat with digital mars compiler, but it seems not to
 recognise the libraries.
 I've used the implib utility.
 The command line looks like this:
 
 dmc -L/libexpat main.cpp
 
 The code compiles well, but when i try to link it, i have the following
 messages:
 
 link main,,,user32+kernel32/noi/libexpat;
 
 OPTLINK (R) for Win32  Release 7.50B1
 Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved
 
 OPTLINK : Warning 9: Unknown Option : LIBEXPAT
 main.obj(main) 
 Error 42: Symbol Undefined _XML_ParserFree
 main.obj(main) 
 Error 42: Symbol Undefined _XML_GetCurrentLineNumber
 main.obj(main) 
 Error 42: Symbol Undefined _XML_ErrorString
 main.obj(main) 
 Error 42: Symbol Undefined _XML_GetErrorCode
 main.obj(main) 
 Error 42: Symbol Undefined _XML_Parse
 main.obj(main) 
 Error 42: Symbol Undefined _XML_SetCharacterDataHandler
 main.obj(main) 
 Error 42: Symbol Undefined _XML_SetElementHandler
 main.obj(main) 
 Error 42: Symbol Undefined _XML_SetUserData
 main.obj(main) 
 Error 42: Symbol Undefined _XML_ParserCreate
 
 --- errorlevel 9
 
 Any ideea?
 Maybe i do not use the proper parameters on the command line?
 
 Regards
 Adi
 
 

May 12 2004
parent reply adi <adi_member pathlink.com> writes:
Thanks again for the fast reply,

It does not work this way. I've tried it. I have the same error message.
I've tried it even with the linker. 

I have another question is it possible to use lib files made with another
compiler with digital mars or not. It seems that it is not.



In article <c7tkms$20id$1 digitaldaemon.com>, -scooter- says...
Try putting the library after main.cpp:

dmc main.cpp libexpat.lib

You cannot fail if you assume that a linker (including the GNU and Linux and 
FreeBSD linkers) resolves unknown symbols in one pass: it resolves unknown 
symbols from each file it processes from left to right on the command line.

adi wrote:

 I've tried to use expat with digital mars compiler, but it seems not to
 recognise the libraries.
 I've used the implib utility.
 The command line looks like this:
 
 dmc -L/libexpat main.cpp
 
 The code compiles well, but when i try to link it, i have the following
 messages:
 
 link main,,,user32+kernel32/noi/libexpat;
 
 OPTLINK (R) for Win32  Release 7.50B1
 Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved
 
 OPTLINK : Warning 9: Unknown Option : LIBEXPAT
 main.obj(main) 
 Error 42: Symbol Undefined _XML_ParserFree
 main.obj(main) 
 Error 42: Symbol Undefined _XML_GetCurrentLineNumber
 main.obj(main) 
 Error 42: Symbol Undefined _XML_ErrorString
 main.obj(main) 
 Error 42: Symbol Undefined _XML_GetErrorCode
 main.obj(main) 
 Error 42: Symbol Undefined _XML_Parse
 main.obj(main) 
 Error 42: Symbol Undefined _XML_SetCharacterDataHandler
 main.obj(main) 
 Error 42: Symbol Undefined _XML_SetElementHandler
 main.obj(main) 
 Error 42: Symbol Undefined _XML_SetUserData
 main.obj(main) 
 Error 42: Symbol Undefined _XML_ParserCreate
 
 --- errorlevel 9
 
 Any ideea?
 Maybe i do not use the proper parameters on the command line?
 
 Regards
 Adi
 
 


May 12 2004
next sibling parent reply "Walter" <newshound digitalmars.com> writes:
The dm linker works with OMF files, not COFF files. There is a utility to
convert from COFF libraries to OMF libraries, coff2omf.exe.
www.digitalmars.com/ctg/coff2omf.html

Also, scooter is correct in how to specify a library file to dmc.

"adi" <adi_member pathlink.com> wrote in message
news:c7tv08$2fni$1 digitaldaemon.com...
 Thanks again for the fast reply,

 It does not work this way. I've tried it. I have the same error message.
 I've tried it even with the linker.

 I have another question is it possible to use lib files made with another
 compiler with digital mars or not. It seems that it is not.



 In article <c7tkms$20id$1 digitaldaemon.com>, -scooter- says...
Try putting the library after main.cpp:

dmc main.cpp libexpat.lib

You cannot fail if you assume that a linker (including the GNU and Linux


FreeBSD linkers) resolves unknown symbols in one pass: it resolves


symbols from each file it processes from left to right on the command


adi wrote:

 I've tried to use expat with digital mars compiler, but it seems not to
 recognise the libraries.
 I've used the implib utility.
 The command line looks like this:

 dmc -L/libexpat main.cpp

 The code compiles well, but when i try to link it, i have the following
 messages:

 link main,,,user32+kernel32/noi/libexpat;

 OPTLINK (R) for Win32  Release 7.50B1
 Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

 OPTLINK : Warning 9: Unknown Option : LIBEXPAT
 main.obj(main)
 Error 42: Symbol Undefined _XML_ParserFree
 main.obj(main)
 Error 42: Symbol Undefined _XML_GetCurrentLineNumber
 main.obj(main)
 Error 42: Symbol Undefined _XML_ErrorString
 main.obj(main)
 Error 42: Symbol Undefined _XML_GetErrorCode
 main.obj(main)
 Error 42: Symbol Undefined _XML_Parse
 main.obj(main)
 Error 42: Symbol Undefined _XML_SetCharacterDataHandler
 main.obj(main)
 Error 42: Symbol Undefined _XML_SetElementHandler
 main.obj(main)
 Error 42: Symbol Undefined _XML_SetUserData
 main.obj(main)
 Error 42: Symbol Undefined _XML_ParserCreate

 --- errorlevel 9

 Any ideea?
 Maybe i do not use the proper parameters on the command line?

 Regards
 Adi



May 12 2004
parent adi <adi_member pathlink.com> writes:
Thank you all a lot. After converting the lib with coff2omf the executable file
is generated. Unfortunatelly the program crashes when I try to parse the file.
The one compiled with mingw works well with the same code.
I will try and work on it some more.

Thank you all
Adi.

In article <c7u4dk$2npq$1 digitaldaemon.com>, Walter says...
The dm linker works with OMF files, not COFF files. There is a utility to
convert from COFF libraries to OMF libraries, coff2omf.exe.
www.digitalmars.com/ctg/coff2omf.html

Also, scooter is correct in how to specify a library file to dmc.

"adi" <adi_member pathlink.com> wrote in message
news:c7tv08$2fni$1 digitaldaemon.com...
 Thanks again for the fast reply,

 It does not work this way. I've tried it. I have the same error message.
 I've tried it even with the linker.

 I have another question is it possible to use lib files made with another
 compiler with digital mars or not. It seems that it is not.



 In article <c7tkms$20id$1 digitaldaemon.com>, -scooter- says...
Try putting the library after main.cpp:

dmc main.cpp libexpat.lib

You cannot fail if you assume that a linker (including the GNU and Linux


FreeBSD linkers) resolves unknown symbols in one pass: it resolves


symbols from each file it processes from left to right on the command


adi wrote:

 I've tried to use expat with digital mars compiler, but it seems not to
 recognise the libraries.
 I've used the implib utility.
 The command line looks like this:

 dmc -L/libexpat main.cpp

 The code compiles well, but when i try to link it, i have the following
 messages:

 link main,,,user32+kernel32/noi/libexpat;

 OPTLINK (R) for Win32  Release 7.50B1
 Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

 OPTLINK : Warning 9: Unknown Option : LIBEXPAT
 main.obj(main)
 Error 42: Symbol Undefined _XML_ParserFree
 main.obj(main)
 Error 42: Symbol Undefined _XML_GetCurrentLineNumber
 main.obj(main)
 Error 42: Symbol Undefined _XML_ErrorString
 main.obj(main)
 Error 42: Symbol Undefined _XML_GetErrorCode
 main.obj(main)
 Error 42: Symbol Undefined _XML_Parse
 main.obj(main)
 Error 42: Symbol Undefined _XML_SetCharacterDataHandler
 main.obj(main)
 Error 42: Symbol Undefined _XML_SetElementHandler
 main.obj(main)
 Error 42: Symbol Undefined _XML_SetUserData
 main.obj(main)
 Error 42: Symbol Undefined _XML_ParserCreate

 --- errorlevel 9

 Any ideea?
 Maybe i do not use the proper parameters on the command line?

 Regards
 Adi




May 12 2004
prev sibling parent Scott Michel <scottm cs.ucla.edu> writes:
adi wrote:
 Thanks again for the fast reply,
 
 It does not work this way. I've tried it. I have the same error message.
 I've tried it even with the linker.
 
 I have another question is it possible to use lib files made with another
 compiler with digital mars or not. It seems that it is not.

Your main problem, if it's not the library format, is the "-L/libexpat". If you take a look at the DMC compiler's options page (http://www.digitalmars.com/ctg/sc.html), you'll immediately notice that "-L/" is used to specify options for the linker. This means that "-L/libexpat" isn't an option OPTLINK understands. :-)
May 12 2004
prev sibling parent reply Jan Knepper <jan smartsoft.us> writes:
Just recompile the expat code into a .LIB and include that .LIB in your 
link command.
I have used expat with DMC for years!

Jan



adi wrote:

 I've tried to use expat with digital mars compiler, but it seems not to
 recognise the libraries.
 I've used the implib utility.
 The command line looks like this:
 
 dmc -L/libexpat main.cpp
 
 The code compiles well, but when i try to link it, i have the following
 messages:
 
 link main,,,user32+kernel32/noi/libexpat;
 
 OPTLINK (R) for Win32  Release 7.50B1
 Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved
 
 OPTLINK : Warning 9: Unknown Option : LIBEXPAT
 main.obj(main) 
 Error 42: Symbol Undefined _XML_ParserFree
 main.obj(main) 
 Error 42: Symbol Undefined _XML_GetCurrentLineNumber
 main.obj(main) 
 Error 42: Symbol Undefined _XML_ErrorString
 main.obj(main) 
 Error 42: Symbol Undefined _XML_GetErrorCode
 main.obj(main) 
 Error 42: Symbol Undefined _XML_Parse
 main.obj(main) 
 Error 42: Symbol Undefined _XML_SetCharacterDataHandler
 main.obj(main) 
 Error 42: Symbol Undefined _XML_SetElementHandler
 main.obj(main) 
 Error 42: Symbol Undefined _XML_SetUserData
 main.obj(main) 
 Error 42: Symbol Undefined _XML_ParserCreate
 
 --- errorlevel 9
 
 Any ideea?
 Maybe i do not use the proper parameters on the command line?
 
 Regards
 Adi
 
 

-- ManiaC++ Jan Knepper But as for me and my household, we shall use Mozilla... www.mozilla.org
May 12 2004
parent reply adi <adi_member pathlink.com> writes:
Perhaps this is the next step I will try as the executable file still crashes
when I try to parse the file (the odd thing is that it creates the parser
without problems).

Thanks 
Adi

In article <c7umbv$q49$1 digitaldaemon.com>, Jan Knepper says...
Just recompile the expat code into a .LIB and include that .LIB in your 
link command.
I have used expat with DMC for years!

Jan



adi wrote:

 I've tried to use expat with digital mars compiler, but it seems not to
 recognise the libraries.
 I've used the implib utility.
 The command line looks like this:
 
 dmc -L/libexpat main.cpp
 
 The code compiles well, but when i try to link it, i have the following
 messages:
 
 link main,,,user32+kernel32/noi/libexpat;
 
 OPTLINK (R) for Win32  Release 7.50B1
 Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved
 
 OPTLINK : Warning 9: Unknown Option : LIBEXPAT
 main.obj(main) 
 Error 42: Symbol Undefined _XML_ParserFree
 main.obj(main) 
 Error 42: Symbol Undefined _XML_GetCurrentLineNumber
 main.obj(main) 
 Error 42: Symbol Undefined _XML_ErrorString
 main.obj(main) 
 Error 42: Symbol Undefined _XML_GetErrorCode
 main.obj(main) 
 Error 42: Symbol Undefined _XML_Parse
 main.obj(main) 
 Error 42: Symbol Undefined _XML_SetCharacterDataHandler
 main.obj(main) 
 Error 42: Symbol Undefined _XML_SetElementHandler
 main.obj(main) 
 Error 42: Symbol Undefined _XML_SetUserData
 main.obj(main) 
 Error 42: Symbol Undefined _XML_ParserCreate
 
 --- errorlevel 9
 
 Any ideea?
 Maybe i do not use the proper parameters on the command line?
 
 Regards
 Adi
 
 

-- ManiaC++ Jan Knepper But as for me and my household, we shall use Mozilla... www.mozilla.org

May 12 2004
parent reply -scooter- <scottm cs.ucla.edu> writes:
adi wrote:

 Perhaps this is the next step I will try as the executable file still crashes
 when I try to parse the file (the odd thing is that it creates the parser
 without problems).

"Just 'cos it links don't mean it'll run!" If you compile some code with debug turned on, a compiler might initialize all variables to 0. If the optimizer is turned on, that initialization doesn't happen. Suddenly your code doesn't work. Yes, it's the library's fault, not yours. But the problem doesn't show up until you run the program due to variations in how a compiler works. In Win32, there are also variations in calling convetions, another thing to consider. DMC, in my experience, has found bugs in my code far better than GCC. But I don't work solely under Win32. The moral of the story: use different compilers to make your code more robust. :-) -scooter
May 17 2004
parent reply Jan Knepper <jan smartsoft.us> writes:
-scooter- wrote:
 DMC, in my experience, has found bugs in my code far better than GCC. 
 But I don't work solely under Win32. The moral of the story: use 
 different compilers to make your code more robust. :-)

I used to do that with Zortech/Symantec C++, Borland C++, Watcom C++, M$ C-- and GNU C++... Until I got so fed up with all of the latter than I just fell back onto Zortech/Symantec C++ (now Digital Mars C++). I would have to check again, but I have quite a bit of code that just does not compile with most of "the others" while there is absolutely nothing wrong with it... ;-) -- ManiaC++ Jan Knepper But as for me and my household, we shall use Mozilla... www.mozilla.org
May 17 2004
parent reply -scooter- <scottm cs.ucla.edu> writes:
Jan Knepper wrote:

 -scooter- wrote:

 C-- and GNU C++... Until I got so fed up with all of the latter than I 
 just fell back onto Zortech/Symantec C++ (now Digital Mars C++).
 I would have to check again, but I have quite a bit of code that just 
 does not compile with most of "the others" while there is absolutely 
 nothing wrong with it... ;-)

Unfortunately, there's no version of DMC for FreeBSD. Although, if Walter does output proper ELF object files for Linux, there's no reason why the same compiler couldn't work under FreeBSD. Yeah, FreeBSD: You know the OS that runs Linux binaries faster than Linux does... :-) (*) (*) This was true not so long ago. The Linux VM may have improved to the point that the two OSes have achieved parity, the "O(1)" scheduler may also have improved things for Linux as well.
May 19 2004
parent Jan Knepper <jan smartsoft.us> writes:
-scooter- wrote:
 Unfortunately, there's no version of DMC for FreeBSD. Although, if 
 Walter does output proper ELF object files for Linux, there's no reason 
 why the same compiler couldn't work under FreeBSD.

I will be jumping of joy the day he announces it, believe me!
 Yeah, FreeBSD: You know the OS that runs Linux binaries faster than 
 Linux does... :-) (*)

HA! www.digitaldaemon.com -- ManiaC++ Jan Knepper But as for me and my household, we shall use Mozilla... www.mozilla.org
May 20 2004