Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. sha code

sha code

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorial
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 11822241
    wrote on last edited by
    #1

    How to include run a program on devc++ when i have my own .h file..i have my own headerfile, but when i run my main.cpp it says, no such file or directory

    A J D 3 Replies Last reply
    0
    • U User 11822241

      How to include run a program on devc++ when i have my own .h file..i have my own headerfile, but when i run my main.cpp it says, no such file or directory

      A Offline
      A Offline
      Afzaal Ahmad Zeeshan
      wrote on last edited by
      #2

      For the header files that are not shipped with compiler as library, you need to specify where to look for. The code for,

      \#include "myheader.h"

      Looks for in the same directory, or the directory of your project to find the header files. Remember, Dev C++ primarily is a port of GCC compiler, so every concept of GCC can be applied here similarly. GCC works fine with

      * projectdirectory
      |- program.c
      |- myheader.h

      // Program
      \#include "myheader.h"

      int main() {
      // Code here.
      }

      Also, remember that the "own headerfile" should not be written in angle brackets, they should be in quotations. For more on this please read, http://stackoverflow.com/questions/257795/header-files-in-dev-c http://gcc.gnu.org/onlinedocs/cpp/Search-Path.html#Search-Path

      The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~

      1 Reply Last reply
      0
      • U User 11822241

        How to include run a program on devc++ when i have my own .h file..i have my own headerfile, but when i run my main.cpp it says, no such file or directory

        J Offline
        J Offline
        Jochen Arndt
        wrote on last edited by
        #3

        Please edit your question adding some more information (code snippet and indication where the error occurs, exact error message). So I can only guess that you have something like

        // File main.cpp
        #include "myheader.h"

        int main()
        {
        // some code
        return 0;
        }

        If the error is something like "myheader.h: No such file or directory" you have to tell the compiler which directories should be searched for include files. Because Dev-C++ uses the GCC compiler, it can be done using the command line option -I. I don't use Dev-C++ but a quick research shows that there is a project option to specifiy additional pathes at Project - Options - Directories - Include.

        1 Reply Last reply
        0
        • U User 11822241

          How to include run a program on devc++ when i have my own .h file..i have my own headerfile, but when i run my main.cpp it says, no such file or directory

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          Member 11855697 wrote:

          ...but when i run my main.cpp it says, no such file or directory

          What in the world is this supposed to mean? How do you run a .cpp file?

          "One man's wage rise is another man's price increase." - Harold Wilson

          "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

          "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups