GIDForums  

Go Back   GIDForums > Computer Programming Forums > MS Visual C++ / MFC Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 01-Sep-2006, 09:07
analeah analeah is offline
New Member
 
Join Date: Sep 2006
Posts: 1
analeah is on a distinguished road

"Cannot Open Include file" MS Visual c++ compile Error


Hi,

I just installed the latest version of Visual C++ from Microsoft on a windows XP system. I have used this program before, but this time, on my new install, when I try to compile, I'm getting an error, "c:\documents and settings\user\desktop\r\listdbl.cpp(1) : fatal error C1083: Cannot open include file: 'listdbl.h': No such file or directory"

What I'm trying to do:
I have a project I'm working on that has a header file "listdbl.h" and two source files that call it, "listdbl.cpp" and a driver. All files are in the same directory:
"c:\documents and settings\user\desktop\r". To start, I opened a new project and added these files. When I tried to compile "listdbl.cpp" I got that error.

What I have tried:
I have tried following the help file on "additional include directories" thinking that this is my problem (and it still may be). For the line to include a file the help says:

"The following command looks for the include files requested by MAIN.c in the following order: first in the directory containing MAIN.c, then in the \INCLUDE directory, then in the \MY\INCLUDE directory, and finally in the directories assigned to the INCLUDE environment variable.

Copy Code
CL /I \INCLUDE /I\MY\INCLUDE MAIN.C"

I tried, "CL /I \INCLUDE /I\C:\Documents and Settings\User\Desktop\Include"

And I'm still getting the same error. Any ideas? Any help is greatly appreciated!

Thank you,
-Leia Chancellor
  #2  
Old 06-Sep-2006, 10:52
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 4,791
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold

Re: "Cannot Open Include file" MS Visual c++ compile Error


Quote:
Originally Posted by analeah
ll, when I try to compile, I'm getting an error, "c:\documents and settings\user\desktop\r\listdbl.cpp(1) : fatal error C1083: Cannot open include file: 'listdbl.h': No such file or directory"

Did you #include "listdbl.h"? (This should work with no extra effort or additional include paths as long as the header file is in the same path as the cpp file(s).)

Or did you #include <x.h>? (This won't work with various compilers that I have used unless you have an include path that is exacly correct.)

For example with the command line: If any file or directory names have spaces in them, then it won't work unless you have quotes around them. So, if your listdbl.cpp and driver.cpp are in your current directory and listdbl.cpp is somewhere else, the command might be something like this:
Code:
cl /I "C:\Documents and Settings\user\Desktop\r" listdbl.cpp driver.cpp

(But the simplest thing for small projects for which you have created the header file(s) is to put them .cpp files and .h files in the same directory, and use the quotes on the #include.)

I, personally, always put my projects in places that I create, and I never (never) create directories or files with spaces in their names. (Unless someone who controls my paycheck forces me to; and that has happened a time or two.)

Regards,

Dave
 
 

Recent GIDBlogWriting a book by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Winsock error when compiling FLTK 2.0 Projects mauriciorossi FLTK Forum 3 16-Aug-2005 11:18
Help with syntax errors PeteGallo C Programming Language 7 08-Aug-2005 21:30
What is "Ambigious symbol" ??*( a compilation error) small_ticket C++ Forum 2 07-Jan-2005 22:10
Can enum have same name as class? crystalattice C++ Forum 3 08-Dec-2004 17:43
fltk-2.0 cvs Plumb FLTK Forum 20 13-Nov-2004 08:10

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 17:02.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.