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.

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 ftp://ftp.digitalmars.com/Digital_Mars_C++/STL/stlport.zip
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.