sha code
-
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
-
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
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 !~
-
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
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. -
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
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