I have 3 files that i have included in a project(class,implementation,program) The program will not compile. it says system can not find specified file. Should i save all these files in the project folder or ... . It's my first time using project to write a class and all that.

Dani AI

Generated

A compact troubleshooting note for that ties into 's IDE question and 's include-path hint.

First, determine whether the message occurs at compile time (missing header) or later (linker or runtime file-open). The exact error line almost always names the missing item; that identifies whether the compiler, the linker, or the running program failed to find a file.

Practical checks:

  • Confirm the file actually exists at the path the build system is using. Project explorers usually show each file's full path — inspect file properties rather than the filesystem alone. On Unix-like systems, filename case must match exactly.
  • Ensure each implementation source is part of the project/makefile. Files placed in the project folder are not automatically compiled unless the project configuration lists them as sources.
  • Look for path issues: spaces, non-ASCII characters, very long paths, or stray file extensions can confuse some toolchains or IDE file dialogs.
  • Precompiled-header or project-default include settings can cause early failures if misconfigured; verify those settings if the build log mentions a pch or similar.

How to get a definitive answer: enable verbose/diagnostic build output and read the full compiler/linker command line and search paths the tool actually used. That output shows exactly where the tool tried to look. A quick isolation test is to create a minimal project with the three files in the same folder and a simple build; if that fixes the error, the root cause is a path or project-reference mismatch.

Useful details to show when requesting further help: the exact error text, the platform/OS, the compiler and IDE (and the full build command from the verbose log).

Recommended Answers

All 2 Replies

Which IDE are you using ?

The process normally involves creating a new console project (if thats what you want), adding the required header and source files to it (preferably in the same folder). The header and the source files are generally added by right clicking on the project name in the left window or whereever your IDE hosts it and then adding the required files by specifying their path.

If you're using command line for compilation add -I<include-path> option where include-path is the path that has your header file.
Another option (quick-fix) is to give full path e.g. #include "/home/nayrb/include/my_header.h"
Don't make this a practice.
Finally if you're using some IDE, answer SOS's question. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.