www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

c++ - How to compile a simple program

↑ ↓ ← =?ISO-8859-2?Q?Micha=B3_Kandulski?= <kandul poczta.onet.pl> writes:
Hi,

I'm new to Digital Mars C++ compiler but quite experienced in C++.
Can anyone tell me the command line options to compile this file:

// a.cpp

#include <iostream>
#include <iomanip>
#include <exception>
#include <stdexcept>

int main()
{
	try
	{
		char c;
		std::cin >> c;
		if(c == 'A')
			throw std::runtime_error("'A' pressed!")
	}
	catch(std::exception& e)
	{
		std::cerr << e.what() std::endl;
	}
	return 0;
}

I tried:
dmc -Ic:\dm\stlport\stlport;c:\dm\include -A a.cpp
but the compiler shows a lot of errors.

I also tried with plenty of other combinations, but the results were not 
satisfying (problems with namespace std, whith catch(exception& ) etc.).

Thanks in advance,
Michal
Apr 24 2003
↑ ↓ → "Walter" <walter digitalmars.com> writes:
Try:
    dmc a -I\dm\stlport\stlport -Ae -Ar

"Micha³ Kandulski" <kandul poczta.onet.pl> wrote in message
news:3EA80048.9020706 poczta.onet.pl...
 Hi,

 I'm new to Digital Mars C++ compiler but quite experienced in C++.
 Can anyone tell me the command line options to compile this file:

 // a.cpp

 #include <iostream>
 #include <iomanip>
 #include <exception>
 #include <stdexcept>

 int main()
 {
 try
 {
 char c;
 std::cin >> c;
 if(c == 'A')
 throw std::runtime_error("'A' pressed!")
 }
 catch(std::exception& e)
 {
 std::cerr << e.what() std::endl;
 }
 return 0;
 }

 I tried:
 dmc -Ic:\dm\stlport\stlport;c:\dm\include -A a.cpp
 but the compiler shows a lot of errors.

 I also tried with plenty of other combinations, but the results were not
 satisfying (problems with namespace std, whith catch(exception& ) etc.).

 Thanks in advance,
 Michal

Apr 24 2003