While compiling a simple code in c++ i get the errors
C:\Users\ila\Desktop\mule\mule.c|1|iostream: No such file or directory|
C:\Users\ila\Desktop\mule\mule.c||In function `main':|
C:\Users\ila\Desktop\mule\mule.c|6|error: `cout' undeclared (first use in this function)|
C:\Users\ila\Desktop\mule\mule.c|6|error: (Each undeclared identifier is reported only once|
C:\Users\ila\Desktop\mule\mule.c|6|error: for each function it appears in.)|
||=== Build finished: 4 errors, 0 warnings ===|
How do I include header files in c++?
geekme 0 Junior Poster in Training
Recommended Answers
Jump to PostProbably differently than you did in your program. But since you didn't post any code, we can't tell what you did wrong.
Jump to PostI notice your source file is called mule.c. Most likely your compiler is automatically detecting the desired language from the source file extension, which means you're not compiling as C++ but as C. C doesn't support the <iostream> header.
Try forcing the compiler to compile as C++, or change …
All 5 Replies
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
geekme 0 Junior Poster in Training
JasonHippy 739 Practically a Master Poster
Narue 5,707 Bad Cop Team Colleague
JasonHippy 739 Practically a Master Poster
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.