Frequently Asked Questions
- D programming language 2 FAQ
- D programming language 1 FAQ
C and C++ FAQ
- C FAQ from comp.lang.c
- C++ FAQ from comp.lang.c++
- C-C++ FAQ from alt.comp.lang.learn.c-c++
- FAQs for other newsgroups
- Can I get it on CD?
- Where's the debugger?
- What's the version of the compiler?
- Can I download the documentation in one zip file?
- Does the WDOSX (Wuschel's DOS eXtender) work with DMC?
- Is the Zed editor still available?
- Will the compiler run under DOS?
- How do I clear the screen?
- How do I work with old CodeView?
- I need an import library for a Windows system DLL
- COFF2OMF converts .lib files to empty files?
- How do I report a bug?
- I need winfax.h or some other new Win SDK header file
- How do I use DirectX with DMC?
- How do I use wxWindows with Digital Mars?
-
Compiling
- What is the sc command?
- Where is the header file <iostream>?
- Redefined type errors when including the socket header files
- When I run the compiler, it just flashes on the screen and disappears?
- I am getting an incomprehensible error message when compiling.
- The compiler gives me an error when accessing a base class?
-
Linking
- I'm getting 'Symbol Undefined' messages while linking
- I'm getting 'Previous Definition Different' messages while linking
- I'm getting 'No Start Address' messages while linking
- I get 'Symbol Undefined _WinMain@16'?
-
Libraries
-
IDDE
- Where's the IDDE?
- How do I specify other compiler flags to the IDDE?
- I'm getting a message about SCT3D32.DLL not installed
- ClassExpress crashes reading resources created by VC++
- IDDE sometimes can't find files, shows paths wrong?
- Resource Editor crashes under Windows ME?
- Why can't I create a workspace in the IDDE?
- The IDDE doesn't seem to work with spaces in filenames
-
DOSX
- Is DOSX still available?
- How do I access video ram in DOSX?
- How do I call a real mode interrupt not implemented by DOSX?
- How do I pass a buffer to a real mode interrupt?
- NASM built .obj files crash with DOSX?
-
Windows
Can I get it on CD?
-
The
C and C++ development system is now available!
It is a download now, not a CD anymore.
Where's the debugger?
-
The
C and C++ Development System
version includes the DMC++ debugger.
Alternatively,
you can use any debugger that works with the Microsoft CodeView
format or linker .MAP format. These include the:
- Symantec debuggers
- Zortech debuggers
- Microsoft debuggers (Codeview, symdeb, windbg, VC++ debugger). Instructions for windbg.
- Rational Systems debuggers
- Multiscope debuggers
Where's the IDDE?
-
The
Development System
version includes the DMC++ Integrated Developing and
Debugging Environment (IDDE).
Alternatively, the Microemacs editor, included in the free download
version, is a fully capable and powerful text editor.
What's the version of the compiler?
-
The version number of the package is given by the filename
starting with 'v' in the \dm directory. Individual programs
in \dm\bin may have different version numbers. The version
of the compiler itself can be found by typing:
\dm\bin\scppnat the command prompt.
When I click on it, a window flashes and disappears?
-
This happens when the program is a console program.
Console programs are meant to be run from the command prompt.
Most of the non-IDDE Digital Mars programs are console programs.
A command prompt window can be created on XP by
clicking on [Start][Command Prompt].
The compiler gives me an error when accessing a base class?
With the code:template <class T> struct Base { int m_member; }; template <class T> struct Derived : public Base<T> { Derived() : m_member(0) { } };the compiler gives an error that the m_member or any other members of Base<T> are not found. Although other compilers accept such code, it is incorrect according to the C++98 Standard 14.6.2-2 and 14.6.2.1-1. Base<T> is a dependent type, and so it is not in scope for template class Derived.
Can I download the documentation in one zip file?
-
All the documentation comes on the
Development System as html files,
as well as the Microsoft API documentation in Windows
Help format.
Is DOSX still available?
-
DOSX is now re-released as X32 for the Digital Mars compilers,
and is now available again! Download the
patch
for X32, and
X32
itself.
If you need the old Symantec or Zortech dos extender version,
and you have an original licensed copy of the Zortech or Symantec
compilers, copy these files:
lib\sdx.lod lib\cx.obj src\dos32\cx.asm src\dos32\lib\x386.libinto the same directories and then you can develop for DOSX again.
Does the WDOSX (Wuschel's DOS eXtender) work with DMC?
-
I don't know, but I don't see why not. Check it out at
www.wuschel.demon.co.uk.
Is the Zed editor still available?
-
It appears to be
here.
Will the compiler run under DOS?
-
No. Although the compiler will build 16 bit DOS programs, the
compiler itself will only run under Win32.
The dos extended versions of
the tool executables are no longer included.
Symantec does offer a freely downloadable set of compilers
that run under DOS
here.
(This link appears to be broken.)
How do I specify other compiler flags to the IDDE?
-
To give 'other' flags (newer ones not on the
property pages) such as -Ab, use the
'defines' edit box and give the flags there. In such a case, you must
explicitely use -D for your defines. If you are only defining,
then -D is not required.
e.g. If you want to define 'NDEBUG' only, specify only 'NDEBUG'. If in addition, you want to specify -Ab, you must write:
-Ab -DNDEBUG
Redefined type errors when including the socket header files
-
There are some name collisions by default when including the
socket header files. It reports about 5 redefined variable types,
fd_set being among them.
fd_set can also be found in types.h and unistd.h.
The solution is to #define _WIN32_WINNT 0x0400 in order to force windows.h to include winsock2.h, not winsock.h.
I'm getting a message about SCT3D32.DLL not installed
-
This can happen when creating an application using the AppExpress
feature of ProjectExpress [Project->New] in the IDDE.
Clicking "use AppExpress" followed by "finish", the message
in a window titled CTL3DV2 appears:
"This application uses SCT3D32.DLL, which has not been correctly installed."This message is generated by SCT3D32.DLL itself (a Microsoft supplied DLL), and is produced when it is not residing in the system directory. SCT3D32.DLL is in the \dm\bin directory. Copy it to your windows system directory (which on NT is \winnt40\system32), and rename the one in \dm\bin to SCT3D32.DLL.OLD.
This is the only known DLL with this problem.
How do I work with old CodeView?
The problem:
Compiling a test program like this,dmc -ms -0 -g -L/co/ma foo.cand proceeding to load CodeView in "real" DOS produces the message:
CV0104 Warning: CodeView information for 'D:\FOO.EXE' is newer than this version of CodeViewThe version of codeview is 4.01 as supplied in the MASM 6.11 package, dated from 1992. Using /cvversion:4 to the linker produces the same result, as well as using compiler option -g4. Using masm to assemble an example program and linking using Microsoft Link does work with codeview. Linking the same .obj file with optlink/cvversion:4 produces the same failure.
The solution:
Optlink runs cvpack when generating cv4 info. This seems to be the cause of the trouble: cv only gives the "info is newer than this version of codeview" error when cvpack is executed without any options. When optlink is given the /nocvpack option, then run cvpack manually with the minimal option, the debugger (cv) then reports with symbolic names. For example:dmc -ms -0 -g -L/co/l/i/nocv foo.exe cvpack /minimal foo.exeand cv will work.
(Thanks to Jack Jay for tracking this down.)
I need an import library for a Windows system DLL
-
Consider the following program test.c:
#include <windows.h> void main() { gethostbyname(0); }The function gethostbyname() is declared in \dm\include\win32\winsock.h, and is exported from the Windows system dLL wsock32.dll. Compiling and linking test.c produces:
E:>dmc test link test,,,user32+kernel32/noi; OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved test.obj(test) Error 42: Symbol Undefined _gethostbyname@4 --- errorlevel 1 E:>If implib is run over wsock32.dll to create wsock32.lib, it still doesn't link because the name in wsock32.dll is gethostbyname, not _gethostbyname@4. The solution is to create a module definition file wsock32.def with the contents:
LIBRARY wsock32 EXETYPE NT SUBSYSTEM WINDOWS EXPORTS _gethostbyname@4 = gethostbynameThis establishes a translation from one name to the other. Add each of the exports needed. Then run implib over it with:
implib wsock32.lib wsock32.defand link with:
dmc test.obj wsock32.liband it should then link successfully.
ClassExpress crashes reading resources created by VC++
-
The problem is in the .rc file. If the project has numbers (i.e.
63552, 10254, ...) in place of menu resource ID's (i.e. IDM_FILE_OPEN,
IDM_FILE_SAVE, ...) then ClassExpress will crash when looking at
"Control ID's in Class" under "Message Maps".
Replace the numbers with the correct resource ID defines from "resource.h".
(Thanks to Andrew Corkan for tracking this down.)
IDDE sometimes can't find files, shows paths wrong?
-
Some parts of the IDDE cannot deal with paths and filenames
that have embedded spaces in them, for example if some of the
source files are in:
\program files\dev\dm
(note
embedded space between "program" and "files"). The solution is
to (1) use paths that don't embed spaces or (2) use the subst
command, i.e. subst z: \program files\dev
and then
refer to the files as being off of z: in the IDDE.
(Thanks to Chris Widdows and Jan Knepper for tracking this down.)
I need winfax.h or some other new Win SDK header file.
-
Windows SDK updates can be downloaded from
sdkupdate
which includes winfax.h.
Resource Editor crashes under Windows ME?
-
When starting RS32 under WinME, it crashes with "Abnormal
program termination", and then a page fault in SFC30.DLL.
The fix is to install Microsoft's update for Microsoft Explorer
MSIE5.5 SP2. This apparently updates some broken system DLLs.
(Thanks to Laurentiu Pancescu for tracking this down.)
How do I use DirectX with DMC?
-
You can get .lib files from MS DIRECTX SDK and
convert them to OMF format with coff2omf.
Then use the .h files from the same SDK.
If using only a limited set of DirectX functions,
it is possible to build a .lib from .DLL using the
implib utility.
(Thanks to Nic Tiger.)
Why can't I create a workspace in the IDDE?
-
The menu items Environment->Workspace->New or
Environment->Workspace->Clone are always grayed in the installation.
The limit is 5 workspaces, and as delivered on the Development System there
are already 5. To create a new workspace, delete one of the
existing ones first.
(Thanks to Frank Albe.)
The IDDE doesn't seem to work with spaces in filenames
-
The IDDE cannot handle spaces, + signs, or ~ characters in filenames
or path names. It cannot be installed in a directory with such
characters in it, for example, it cannot be installed under
\Program Files\.
When I run the compiler, it just flashes on the screen and disappears?
The free downloadable compiler is a console program. That means it needs to be run from within a console window. To start a console for Windows XP, click on [Command Prompt] from the [start] menu. The GUI version of the compiler comes with the Development System.What is the sc command?
The sc and dmc commands are identical.Where is the header file <iostream>?
iostream is part of STLport. It comes with the Development System. It is also available as a separate download. (If the \dm\stlport directory is not there, you'll need to download it.) Do one of the following:- Add the following switch:
-I\dm\stlport\stlport
when compiling. - Add \dm\stlport\stlport to the INCLUDE environment variable search path before \dm\include.
- Modify the INCLUDE entry
in \dm\bin\sc.ini to be:
INCLUDE="%@P%\..\stlport\stlport";"%@P%\..\include";"%@P%\..\mfc\include";%INCLUDE%
I get 'Symbol Undefined _WinMain@16'?
When linking a program as a GUI application, but having a main() like a console application, results in the error message from the linker:link /NOI /DE /PACKF /XN /NT /ENTRY:WinMainCRTStartup /BAS:4194304 /A:512 @tst.LNK Error: c:\dm\lib\SNN.lib(winstart) : Symbol Undefined _WinMain@16 Errors: 1 Warnings: 0 Build failedIf using the IDDE, this is corrected by selecting [Console] under [Target Type] in the first [Tab] of [Project Settings].
If using a module definition (.def) file, these lines should appear in it:
EXETYPE NT SUBSYSTEM CONSOLEDo not use /ENTRY:WinMainCRTStartup in a command to the linker, this specifies a Windows application.
I am getting an incomprehensible error message when compiling.
The syntax and semantics of C++ can be convoluted, and when the compiler encounters an error, it makes a guess at what might have gone wrong and issues an error message. If the construct being compiled is the result of layers of macros, template expansions, typedefs, etc., it can sometimes not be at all clear what is going wrong. When all else fails, here are some techniques for isolating down what the problem is. At each step, verify that the error message continues to be generated.- Redirect the output of the makefile to a .bat file:
make -ffoo.mak >cc.bat
- Edit cc.bat so it is just compiling the source file that fails.
- Rename the source file that fails to test.cpp, and edit cc.bat so it is compiling test.cpp.
- Remove any precompiled header switches from cc.bat.
- Ruthlessly hack off chunks of test.cpp until the smallest source file remains that still shows the error.
- Many projects #include a complicated, confusing mass header files from multiple locations. These header files will also be commonly filled with macros and #if's, making it really hard to be sure what is going on in them. Add the -e and -l switches to cc.bat, which will produce a file called test.lst. This file will have all the #include files included, and all macros will be expanded, and all false conditional code will be removed. Rename test.lst to test.cpp, and continue hacking and slashing off all the code that does not contribute to the error message.
How do I stop the console window from appearing?
Add these lines to the module definition file (.def):EXETYPE NT SUBSYSTEM WINDOWSor add the linker flag -L/exet:nt/su:windows.
A strange extra line is displayed under the menu bar?
This occurs on Windows XP systems running in the standard XP style UI. It does not occur on Win 2K, or XP in "classic" mode. The solution is to make sure the following lines are in the module definition file:EXETYPE NT SUBSYSTEM WINDOWS,4.0
or add the linker flag -L/exet:nt/su:windows:4.0.