Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > C++ Programming
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 9th, 2006, 11:51 PM
Authorized User
 
Join Date: Oct 2006
Location: New York, US
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to mastrgamr
Default help with compiling include files

i use the borland c++ compiler, i have all the link and .cfg files setup... when i first got the program it was working perfectly fine but i dont kno wat happend.
i even used the simplest code "hello world" but wen i compile it 3 errors come up:
>cannot open iostream.h (i've tried "iostream" by itself)
>it doenst even kno wat "endl" and "cout" functions are!!

what do i hav to setup to fix this????

heres the source code im tring to compile (i kno its correct)

// hello.cpp- Testing the Borland C++ Compiler
#include <iostream>
int main()
    {
    cout << "Hello, World!\n";
    }

and here are the errors that came up:

error E2209 C:programs\hello.cpp 2:unable to open include file 'iostream'
error E2451 C:\programs\hello.cpp 5: undefined symbol 'cout' in function main()

WHAT IS WRONG??????!!!

__________________
-Stuart Smith
Reply With Quote
  #2 (permalink)  
Old December 11th, 2006, 08:41 AM
Friend of Wrox
 
Join Date: Jan 2006
Location: Fort Wayne, Indiana, USA.
Posts: 103
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Geo121
Default

alrighty this has a pretty simple solution

the problem is that it can't find your iostream library (obviously as you have said already)

but that is the reason it doesn't recognize cout and endl

inside of that library header file it tells the compiler that in simplest words :

cout is a type of function that does a specific thing

(You will more about this later when you learn to write your own libraries =P )

so if you take care of the iostream error you will solve the problem

what I would suggest is that you make sure that your paths and class paths in your cmd prompt are set

this means :

1) your cmd line is where your source code is located
   ex : i have source code on my desktop so my cmd line should read
     C:\Documents and Settings\User\desktop>

2) your path is set to where your compiler.exe file is (probably bcc55.exe if you have Borland)
   ex : i have bcc55 in My Documents\Borland\bin so i will type this into my cmd line
     path="C:\Documents and Settings\User\My Documents\Borland\bin"

3) your classpath is set to where your libraries are
   ex : mine are in My Documents\Borland\lib so I will type this into my cmd line
     set classpath="C:\Documents and Settings\User\My Documents\Borland\lib"

basically each step says :

1) "This is where my code that needs to be compiled is"

2) "This is where my compiler is so you can reach it outside of it's directory"

3) "This is where my Libraries are so you can reach them outside of thier directory"

Try these steps if it still doesn't work then let me know otherwise here ya go

I also think that once you get comfortable using a compiler like borland

you can switch to a GUI that compiles and links for you so all you do is press a button

I would suggest BloodShed's program : dev C++

look it up and download it (IT'S FREE!)

~ Geo

 ~ You are unique, just like everyone else
Reply With Quote
  #3 (permalink)  
Old December 13th, 2006, 11:09 PM
Authorized User
 
Join Date: Oct 2006
Location: New York, US
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to mastrgamr
Default

THX!!! IT WORKED.

Reply With Quote
  #4 (permalink)  
Old December 14th, 2006, 07:58 AM
Friend of Wrox
 
Join Date: Jan 2006
Location: Fort Wayne, Indiana, USA.
Posts: 103
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Geo121
Default

NO PROB!!! keep up the good work =P

~ Geo

 ~ You are unique, just like everyone else
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Include files tarang SQL Server 2000 1 July 18th, 2007 03:32 AM
Compiling Related java files Jstmehr4u3 J2EE 2 August 9th, 2004 07:18 AM
Include Files jmss66 Classic ASP Basics 16 June 9th, 2004 10:20 PM



All times are GMT -4. The time now is 05:23 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.