Results 1 to 5 of 5

Thread: c++ header files

  1. #1
    Join Date
    Mar 2005
    Location
    Isle of Bute, Scotland
    Beans
    369
    Distro
    Ubuntu Gnome 14.04 Trusty Tahr

    c++ header files

    Just realized this should have been in a different area of Development and Programming
    I am trying to do some c++ programming. I had a problem and posted here. This solved the problem I had but it was pointed out that I was using the wrong header files. e.g
    I had #include <time.h> where I should have had #include <ctime.h>
    and several others.
    I am a real beginner with c generally and more so with c++
    I have been trying to use SDL as well so I guess I have been trying to run before I can walk so I decided to potter around with some simple coding first but I am stuck.
    Problem is as follows:
    Code:
    g++ -o graph6 graph6c.cpp `pkg-config --cflags --libs sdl`
    worked and the program would run but that was with the wrong headers so altering the includes to have ctime.h and cstdlib.h
    caused the compile to fail as the headers could not be found.
    I do have g++ at /usr/bin but do not have the headers anywhere.
    I ran updatedb as root and then locate ctime.h
    but it is not on my system.
    Running 12.04 with all updates.
    I have tried to find them to install them through the package manager but cannot seem to do so.
    Can someone please explain how I can overcome this problem please?
    tia
    Last edited by linuxonbute; January 14th, 2013 at 04:29 PM. Reason: update
    Running 14.04 on my HP Pavilion g6 4 Gig Ram 320 Gig Disc

  2. #2
    Join Date
    Apr 2012
    Beans
    7,256

    Re: c++ header files

    The modern C++ standard include files don't have the .h suffix - try

    Code:
    #include <ctime>
    and so on instead - they should be located somewhere like /usr/include/c++/4.6/ctime etc.

  3. #3
    Join Date
    Jan 2013
    Beans
    1

    Re: c++ header files

    hello....!!!!!!!!Respected experts...

    I am new in this forum..

    i want to create a website for c, C++ and java programming source code..

  4. #4
    Join Date
    Mar 2005
    Location
    Isle of Bute, Scotland
    Beans
    369
    Distro
    Ubuntu Gnome 14.04 Trusty Tahr

    Re: c++ header files

    Well shows I really am new at this.
    It compiled fine with that simple change.
    I have not found that mentioned anywhere I searched!
    Thanks so much.
    Running 14.04 on my HP Pavilion g6 4 Gig Ram 320 Gig Disc

  5. #5
    Join Date
    Mar 2007
    Beans
    763

    Re: c++ header files

    Quote Originally Posted by avidwan View Post
    hello....!!!!!!!!Respected experts...

    I am new in this forum..

    i want to create a website for c, C++ and java programming source code..
    Hi avidwan, welcome to the forum!

    You should start a new topic if you have questions.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •