I'm using "Digital Mars" to compile the following program:

#include <iostream>
using namespace std;

int main() {
cout <<"My name is Abder-Rahman";
return 0;
}

And, this is what I get:

C:\Users\Software Engineer\Desktop\C++\dm852c\dm\bin>dmc print1
Fatal error: unable to open input file 'iostream'
--- errorlevel 1

Any ideas on that?

Thanks.

Dani AI

Generated

A short, practical troubleshooting note based on the thread: the error means the compiler cannot find the standard C++ headers. was right that it usually comes down to the include path or a broken install; and pointed toward the STL/installation side of things. Digital Mars historically requires the STL/ STLport package for full C++ headers, so missing headers are a common cause. Digital Mars downloads / STL information. (digitalmars.com)

Concrete steps to diagnose and fix (safe, reversible actions):

  1. Verify header files exist inside your Digital Mars tree. From a Windows command prompt run:

    dir /b /s iostream*

    or in PowerShell:

    Get-ChildItem -Recurse -Filter iostream* | Select-Object FullName
  2. See what the compiler is actually searching. Run the compiler with verbose output to observe include-search behavior:

    dmc -v yourfile.cpp
  3. If headers are present but not found, add the include folder to the compiler search path for testing (use the command-line switch) or permanently via the compiler initialization file described below.

  4. If headers are missing, install the STL package that matches your DMC version and then point DMC at the STL include directory.

For permanent fixes: DMC reads sc.ini in the same folder as the compiler executable; that file controls INCLUDE and PATH and supports the special %@P% variable and the -I switch for temporary paths. Use sc.ini to add your STL include directory (or pass it on the command line while you test). The DMC docs show these switches and sc.ini behavior. (digitalmars.com)

Notes and cautions: make sure the STL package you install is compatible with your DMC release (Digital Mars lists required versions on the download page). Run the shell as a user with access to the compiler tree to avoid permission traps. If a quick modern toolchain is acceptable, consider using a current GCC/Clang Windows build (MinGW-w64) or Visual Studio Community for built-in STL support.

Recommended Answers

All 3 Replies

The code is fine. Your compiler installation is probably broken. You have a bad include path, permissions problems, or you have files missing.

SWEngineer,
This is a syntax problem with Digital Mars.
I am currently using Bloodshed's IDE and compiler Dev-C++, and your code ran fine (with a few substitutions)
I would recommend switching to a different compiler, but if you would rather use Digital Mars, refer to its documentation.
Dev-C++ is an IDE with a compiler, so its much easier to use, and has many features.

To use STL code in Digital Mars you have to download the library's first
After that you have to switch -I\dm\stlport\stlport so that the compiler can find <iostream>

Let me know if you need anymore help.

P.S. The Readme.html in Digital Mars will give you all this information.

What a lot of bullshit

modify file sc.ini in c:\dm\bin as follows: then save it

[Version]
version=857

[Environment]
PATH=%PATH%;"%@P%..\bin"
BIN="%@P%..\bin"
INCLUDE="%@P%..\stlport\stlport";"%@P%..\include";"%@P%..\mfc\include";%INCLUDE%
;INCLUDE="%@P%..\include";"%@P%..\mfc\include";%INCLUDE%
LIB="%@P%..\lib";"%@P%..\mfc\lib";%LIB%
HELP="%@P%..\help"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.