1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

are standard header files like iostream included in development tools?

Discussion in 'Web Design and Development (archive)' started by debo, Jan 15, 2004.

  1. macrumors regular

    #1
    I know this isn't exactly web development but I thought this was the best place for it.

    I wrote a simple program:

    #include <iostream>
    #include <stdlib>
    int main()
    {
    int i=0;
    while (i<10)
    {
    cout<<"i="<<i<<"\n";
    i++;
    }
    return (0);
    }

    and when I try to compile it with g++ it gives me errors that indicate that those header files aren't there. I've tried it with the .h on the ends also with the same results.
     
  2. Administrator

    Doctor Q

    Staff Member

    #2
    Maybe your include path is just missing the right directories. Do you have these files?

    /usr/include/gcc/darwin/2.95.2/g++/iostream.h

    /usr/include/gcc/darwin/3.1/g++-v3/backward/iostream.h

    /usr/include/gcc/darwin/3.3/c++/backward/iostream.h
     
  3. macrumors regular

    #3
    Yes I have those. Is there anyway to set it so if I just say #include <stdlib> it knows to go to that directory? As opposed to #include "myclass.h" where it would look into the directory that my file was in? Also, is there any way to look at the directories like usr from the Mac HD on the desktop?
     
  4. Administrator

    Doctor Q

    Staff Member

    #4
    I think that if you set the CPATH environment variable to a list of directories separated by colons, those directories will be included in the include-file search path. Otherwise, you can use the -I mydirectory or -isystem mydirectory switch on your gcc command line.
    Yes, in the Finder, select menu choice Go -> Go to Folder... and type the directory path, e.g., /usr or /usr/include.
     
  5. macrumors 68000

    Fukui

    #5
    Click the finder, click the "go" menu and choose "go to folder" put in the path to the usr directory ( /usr ) and press enter, it should show up. You could then make a shortcut in the finder sidebar or dock or something to get to it quickly.
     

Share This Page