www.digitalmars.com         C & C++   DMDScript  

c++ - USE16/USE32 Mismatch.. is this causing my problems?

reply "Darren Fitzpatrick" <darrenf cats.ucsc.edu> writes:
Hi,

I'm trying to change over from MSVC++ to dmc and I've been running into a
few problems.
The program I am trying to compile is a 3D Terrain viewing app writtin using
OpenGL and
the FLTK opengl library. After a few hours of tinkering, I was able to
create a .def file
which fixed my unresolved external woes (or at least now the compiler
doesn't complain,
who knows what will happen once I get my current problem fixed.) I used
MSVC++'s
link /lib /convert to change the lib files to the old COFF format, then used
coff2omf to convert to OMF.
To create my def file I used libunres to get the unmangled versions of
names, then used these to create the def file.
Was this correct? Anyways, my main problem now is the errors OPTLINK is
giving me which
I cannot find explanations to in the documentation. Can anyone give me any
ideas on what
flags/switches I need to use or what the hell I do to resolve this
USE16/USE32 mismatch which
I think is at the root of my problem? From what I can gather, the memory
module the compiler
is using is incorrect. Any help? plllllllease?? Thanks!

Darren Fitzpatrick

*** begin paste***

C:\DOCUME~1\dahden\MYDOCU~1\prog3Win32>dmc terrainmain.cpp terrainview.cpp
terra
inviewui.cpp terrainview.def
terrainmain.cpp:
terrainview.cpp:
terrainviewui.cpp:
link
terrainmain+terrainview+terrainviewui,,,user32+kernel32,terrainview/noi;
OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

OPTLINK : Warning 148: USE16/USE32 Mismatch : DGROUP
C:\dm\bin\..\lib\SNN.lib(constart)
 Error 83: Illegal frame on start address
OPTLINK : Warning 174: 32-bit Segments Inappropriate for 16-bit Segmented
output

terrainmain.obj(terrainmain)
 Error 35: Cannot Reach TARGET from FRAME at Relative 00007H  from
 Segment _TEXT
 FRAME  = Frame of Group FLAT 0000
 TARGET = External Symbol ??2 YAPAXI Z (void *cdecl new(unsigned )) 02EBCH
 FIXUPP Type = 32-bit Conditional JMP

--- errorlevel 2

*** end paste***
May 08 2003
parent reply "Darren Fitzpatrick" <darrenf cats.ucsc.edu> writes:
Oops, forgot to mention one thing that may help. The warning about
USE16/USE32 Mismatch and frame errors only appeared after I
made my .def file. Could it be that the compiler expects me to put
more information into the def file than I have included? I only put in
enough to fix the unresolved externals. Anyways, I thought maybe
posting the def file too might help. So here goes:

*** begin TerrainView.def ***
IMPORTS

_glPushMatrix 0=opengl.glPushMatrix
_glPopMatrix 0=opengl.glPopMatrix
_glMatrixMode 4=opengl.glMatrixMode
_glRasterPos2i 8=opengl.glRasterPos2i
_glLoadIdentity 0=opengl.glLoadIdentity
_glClear 4=opengl.glClear
_glColor3f 12=opengl.glColor3f
_glCallList 4=opengl.glCallList
_glIsList 4=opengl.glIsList
_glPolygonMode 8=opengl.glPolygonMode
_glScalef 12=opengl.glScalef
_glRotatef 16=opengl.glRotatef
_glTranslatef 12=opengl.glTranslatef
_glViewport 16=opengl.glViewport
_glBlendFunc 8=opengl.glBlendFunc
_glEnable 4=opengl.glEnable
_glDepthFunc 4=opengl.glDepthFunc
_glEndList 0=opengl.glEndList
_glEnd 0=opengl.glEnd
_glVertex3fv 4=opengl.glVertex3fv
_glColor4f 16=opengl.glColor4f
_glBegin 4=opengl.glBegin
_glShadeModel 4=opengl.glShadeModel
_glNewList 8=opengl.glNewList
_glGenLists 4=opengl.glGenLists
_glDeleteLists 8=opengl.glDeleteLists
?run Fl  SAHXZ=fltk.?run Fl  SAHXZ
?visual Fl  SAHH Z=fltk.?visual Fl  SAHH Z
?draw Fl_Window  MAEXXZ=fltk.?draw Fl_Window  MAEXXZ
?resize Fl_Gl_Window  UAEXHHHH Z=fltk.?resize Fl_Gl_Window  UAEXHHHH Z
?flush Fl_Gl_Window  UAEXXZ=fltk.?flush Fl_Gl_Window  UAEXXZ
?show Fl_Gl_Window  UAEXXZ=fltk.?show Fl_Gl_Window  UAEXXZ
?hide Fl_Gl_Window  UAEXXZ=fltk.?hide Fl_Gl_Window  UAEXXZ
?draw_overlay Fl_Gl_Window  EAEXXZ=fltk.?draw_overlay Fl_Gl_Window  EAEXXZ
?handle Fl_Window  UAEHH Z=fltk.?handle Fl_Window  UAEHH Z
?redraw Fl_Widget  QAEXXZ=fltk.?redraw Fl_Widget  QAEXXZ
?value Fl_Valuator  QAEHN Z=fltk.?value Fl_Valuator  QAEHN Z
?e_state Fl  2HA=fltk.?e_state Fl  2HA
?e_y Fl  2HA=fltk.?e_y Fl  2HA
?e_x Fl  2HA=fltk.?e_x Fl  2HA
?swap_buffers Fl_Gl_Window  QAEXXZ=fltk.?swap_buffers Fl_Gl_Window  QAEXXZ
?glutBitmapWidth  YAHPAXH Z=fltk.?glutBitmapWidth  YAHPAXH Z
?glutBitmapCharacter  YAXPAXH Z=fltk.?glutBitmapCharacter  YAXPAXH Z
??1Fl_Gl_Window  UAE XZ=fltk.??1Fl_Gl_Window  UAE XZ
?init Fl_Gl_Window  AAEXXZ=fltk.?init Fl_Gl_Window  AAEXXZ
??0Fl_Window  QAE HHHHPBD Z=fltk.??0Fl_Window  QAE HHHHPBD Z
?draw Fl_Box  MAEXXZ=fltk.?draw Fl_Box  MAEXXZ
?handle Fl_Box  UAEHH Z=fltk.?handle Fl_Box  UAEHH Z
?resize Fl_Widget  UAEXHHHH Z=fltk.?resize Fl_Widget  UAEXHHHH Z
??1Fl_Widget  UAE XZ=fltk.??1Fl_Widget  UAE XZ
?copy Fl_Image  UAEPAV1 HH Z=fltk.?copy Fl_Image  UAEPAV1 HH Z
?color_average Fl_Image  UAEXW4Fl_Color  M Z=fltk.?color_average Fl_Image  U
AEXW4Fl_Color  M Z
?desaturate Fl_Image  UAEXXZ=fltk.?desaturate Fl_Image  UAEXXZ
?label Fl_Image  UAEXPAUFl_Menu_Item   Z=fltk.?label Fl_Image  UAEXPAUFl_Men
u_Item   Z
?label Fl_Image  UAEXPAVFl_Widget   Z=fltk.?label Fl_Image  UAEXPAVFl_Widget
   Z
?draw Fl_Image  UAEXHHHHHH Z=fltk.?draw Fl_Image  UAEXHHHHHH Z
?uncache Fl_Image  UAEXXZ=fltk.?uncache Fl_Image  UAEXXZ
??1Fl_Image  UAE XZ=fltk.??1Fl_Image  UAE XZ
?copy Fl_Pixmap  UAEPAVFl_Image  HH Z=fltk.?copy Fl_Pixmap  UAEPAVFl_Image  
HH Z
?color_average Fl_Pixmap  UAEXW4Fl_Color  M Z=fltk.?color_average Fl_Pixmap 
 UAEXW4Fl_Color  M Z
?desaturate Fl_Pixmap  UAEXXZ=fltk.?desaturate Fl_Pixmap  UAEXXZ
?label Fl_Pixmap  UAEXPAUFl_Menu_Item   Z=fltk.?label Fl_Pixmap  UAEXPAUFl_M
enu_Item   Z
??0Fl_Window  QAE HHPBD Z=fltk.??0Fl_Window  QAE HHPBD Z
?value Fl_Button  QAEHH Z=fltk.?value Fl_Button  QAEHH Z
?step Fl_Valuator  QAEXN Z=fltk.?step Fl_Valuator  QAEXN Z
??0Fl_Value_Slider  QAE HHHHPBD Z=fltk.??0Fl_Value_Slider  QAE HHHHPBD Z
??0Fl_Widget  IAE HHHHPBD Z=fltk.??0Fl_Widget  IAE HHHHPBD Z
??0Fl_Input  QAE HHHHPBD Z=fltk.??0Fl_Input  QAE HHHHPBD Z
?value Fl_Input_  QAEHPBD Z=fltk.?value Fl_Input_  QAEHPBD Z
??0Fl_Button  QAE HHHHPBD Z=fltk.??0Fl_Button  QAE HHHHPBD Z
??0Fl_Group  QAE HHHHPBD Z=fltk.??0Fl_Group  QAE HHHHPBD Z
?end Fl_Group  QAEXXZ=fltk.?end Fl_Group  QAEXXZ
?show Fl_Window  QAEXHPAPAD Z=fltk.?show Fl_Window  QAEXHPAPAD Z
?bounds Fl_Slider  QAEXNN Z=flkt.?bounds Fl_Slider  QAEXNN Z
?set_data Fl_Pixmap  AAEXPBQBD Z=fltk.?set_data Fl_Pixmap  AAEXPBQBD Z
?measure Fl_Pixmap  IAEXXZ=fltk.?measure Fl_Pixmap  IAEXXZ
??1Fl_Pixmap  UAE XZ=fltk.??1Fl_Pixmap  UAE XZ
?uncache Fl_Pixmap  UAEXXZ=fltk.?uncache Fl_Pixmap  UAEXXZ
?draw Fl_Pixmap  UAEXHHHHHH Z=fltk.?draw Fl_Pixmap  UAEXHHHHHH Z
?label Fl_Pixmap  UAEXPAVFl_Widget   Z=fltk.?label Fl_Pixmap  UAEXPAVFl_Widg
et   Z
_gluOrtho2D 32=glu.gluOrtho2D
_gluPerspective 32=glu.gluPerspective
?glutBitmapHelvetica12  3UGlut_Bitmap_Font  A=glut32.glutBitmapHelvetica12

*** end TerrainView.def ***
May 08 2003
parent reply "Walter" <walter digitalmars.com> writes:
The mismatch means you are trying to link together 16 bit code and 32 bit
code. Check carefully that all the code, libraries, etc., you are linking
together are either all 16 bit code or all 32 bit code.
May 08 2003
parent "Darren Fitzpatrick" <darrenf cats.ucsc.edu> writes:
Hmm.. well, I've double checked all the libraries I've added and they
were all converted from 32bit MSVC++ libraries and seem to work
fine. The program is a 32 bit program. This error message seems
particularly interesting: "OPTLINK : Warning 174: 32-bit Segments
Inappropriate for 16-bit Segmented output." Does this mean OPTLINK
is trying to create 16bit output? Then I would understand why I am having
this problem as everything I'm using is 32bit. I thought however that if
a memory model isn't specified OPTLINK defaults to 32bit output??
Perhaps if I explicitly state the memory model I want in my def file?


"Walter" <walter digitalmars.com> wrote in message
news:b9ekpq$1mc1$1 digitaldaemon.com...
 The mismatch means you are trying to link together 16 bit code and 32 bit
 code. Check carefully that all the code, libraries, etc., you are linking
 together are either all 16 bit code or all 32 bit code.
May 08 2003