Like Tree1Likes

Where to include path of header files in Visual Studio

This is a discussion on Where to include path of header files in Visual Studio within the C++ Programming forums, part of the General Programming Boards category; Hello, I am new to Visual C++ with MS Visual Studio. I was trying to debug a program when I ...

  1. #1
    Registered User
    Join Date
    May 2012
    Posts
    21

    Where to include path of header files in Visual Studio

    Hello,

    I am new to Visual C++ with MS Visual Studio. I was trying to debug a program when I got the error:

    stdafx.h(15) : fatal error C1083: Cannot open include file: 'afxwin.h': No such file or directory

    I have the MFC library and the files stdafx.h etc in my PC. So as I understand, I simply need to give the proper path in the Visual Studio. Can anyone pls. tell me how to do so.

    Thanks,
    Emma Good

  2. #2
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,794
    You could probably just search your computer for afxwin.h and wherever it is that's the folder.
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

  3. #3
    Registered User
    Join Date
    May 2012
    Posts
    21
    Quote Originally Posted by hk_mp5kpdw View Post
    You could probably just search your computer for afxwin.h and wherever it is that's the folder.
    I had searched the computer to find the files but the C++ compiler is not able to read the same. I wanted to know how to include the same through the compiler (Visual Studio)

    Regards,

    Emma .

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,457
    Then configure your project settings to include the folder as a location to search for header files. I do not remember the setting off hand, but if you poke around the configuration you should eventually find it. Note that you should specify the folder that contains afxwin.h, not the path to the file itself.
    emmagood likes this.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    Registered User
    Join Date
    May 2012
    Posts
    21
    OK, I will try that.

    Thanks,

    Emma Good.

  6. #6
    Registered User
    Join Date
    May 2012
    Posts
    21
    Hi,

    I was able to solve the header file problem. But I am getting a few LNK errors. Any ideas pls:

    ***************
    Linking...
    ChSettings.obj : error LNK2019: unresolved external symbol ___security_cookie referenced in function "public: __thiscall CChSettings::CChSettings(class CWnd *)" (??0CChSettings@@QAE@PAVCWnd@@@Z)
    DataLogger2.obj : error LNK2001: unresolved external symbol ___security_cookie
    DataLogger2Dlg.obj : error LNK2001: unresolved external symbol ___security_cookie
    SerialCom.obj : error LNK2001: unresolved external symbol ___security_cookie
    ChSettings.obj : error LNK2019: unresolved external symbol ___CxxFrameHandler3 referenced in function __ehhandler$??0CChSettings@@QAE@PAVCWnd@@@Z
    DataLogger2.obj : error LNK2001: unresolved external symbol ___CxxFrameHandler3
    DataLogger2Dlg.obj : error LNK2001: unresolved external symbol ___CxxFrameHandler3
    SerialCom.obj : error LNK2001: unresolved external symbol ___CxxFrameHandler3
    ChSettings.obj : error LNK2019: unresolved external symbol @__security_check_cookie@4 referenced in function __ehhandler$??0CChSettings@@QAE@PAVCWnd@@@Z
    DataLogger2.obj : error LNK2001: unresolved external symbol @__security_check_cookie@4
    DataLogger2Dlg.obj : error LNK2001: unresolved external symbol @__security_check_cookie@4
    SerialCom.obj : error LNK2001: unresolved external symbol @__security_check_cookie@4
    ChSettings.obj : error LNK2019: unresolved external symbol __RTC_CheckEsp referenced in function "public: __thiscall CChSettings::CChSettings(class CWnd *)" (??0CChSettings@@QAE@PAVCWnd@@@Z)
    DataLogger2.obj : error LNK2001: unresolved external symbol __RTC_CheckEsp
    DataLogger2Dlg.obj : error LNK2001: unresolved external symbol __RTC_CheckEsp
    SerialCom.obj : error LNK2001: unresolved external symbol __RTC_CheckEsp
    ChSettings.obj : error LNK2001: unresolved external symbol __RTC_Shutdown
    DataLogger2.obj : error LNK2001: unresolved external symbol __RTC_Shutdown
    DataLogger2Dlg.obj : error LNK2001: unresolved external symbol __RTC_Shutdown
    SerialCom.obj : error LNK2001: unresolved external symbol __RTC_Shutdown
    ChSettings.obj : error LNK2001: unresolved external symbol __RTC_InitBase
    DataLogger2.obj : error LNK2001: unresolved external symbol __RTC_InitBase
    DataLogger2Dlg.obj : error LNK2001: unresolved external symbol __RTC_InitBase
    SerialCom.obj : error LNK2001: unresolved external symbol __RTC_InitBase
    ChSettings.obj : error LNK2019: unresolved external symbol @_RTC_CheckStackVars@8 referenced in function "protected: void __thiscall CChSettings::OnUpdate(void)" (?OnUpdate@CChSettings@@IAEXXZ)
    DataLogger2.obj : error LNK2001: unresolved external symbol @_RTC_CheckStackVars@8
    DataLogger2Dlg.obj : error LNK2001: unresolved external symbol @_RTC_CheckStackVars@8
    SerialCom.obj : error LNK2001: unresolved external symbol @_RTC_CheckStackVars@8
    DataLogger2.obj : error LNK2019: unresolved external symbol "void __cdecl operator delete[](void *)" (??_V@YAXPAX@Z) referenced in function "public: virtual __thiscall CLPString::~CLPString(void)" (??1CLPString@@UAE@XZ)
    DataLogger2Dlg.obj : error LNK2001: unresolved external symbol "void __cdecl operator delete[](void *)" (??_V@YAXPAX@Z)
    DataLogger2Dlg.obj : error LNK2019: unresolved external symbol "void * __cdecl operator new[](unsigned int)" (??_U@YAPAXI@Z) referenced in function "protected: void __thiscall CLPString::CopyFrom(char const *)" (?CopyFrom@CLPString@@IAEXPBD@Z)
    .\Debug/DataLogger2.exe : fatal error LNK1120: 9 unresolved externals

    **********

    Thanks,

    Emma Good

  7. #7
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,457
    The library should have come with some um, library files (e.g., with a .lib extension) that you need to have linked when you build your executable program. You need to find out what those library files are, then configure your project to link them.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  8. #8
    Registered User
    Join Date
    May 2012
    Posts
    21
    OK.. will look into it... BTW was doing some googleing... do u suppose I need to use bufferoverflow*.lib as well...? I am on V studio 2008 SP1.

    Thanks,
    Emma Good.

  9. #9
    msh
    msh is offline
    Novice
    Join Date
    Jul 2009
    Posts
    568
    Disclaimer: This post shows my ignorance at the time of its making. I claim ownership of but not responsibility for all errors in it. Reference at your own peril.

  10. #10
    Registered User
    Join Date
    May 2012
    Posts
    21
    Well... I checked the directory in which I received the source code etc. But it does not have any .lib files in it. Any other ideas pls.

    Thanks,
    Emma Good

  11. #11
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,457
    Isn't there some kind of README or INSTALL.txt file that you can consult? Or maybe there is actually a pre-made Visual Studio solution file that you can experiment with.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  12. #12
    msh
    msh is offline
    Novice
    Join Date
    Jul 2009
    Posts
    568
    Quote Originally Posted by emmagood View Post
    Well... I checked the directory in which I received the source code etc. But it does not have any .lib files in it. Any other ideas pls.

    Thanks,
    Emma Good
    Show us a list of your includes.
    Disclaimer: This post shows my ignorance at the time of its making. I claim ownership of but not responsibility for all errors in it. Reference at your own peril.

  13. #13
    Registered User
    Join Date
    May 2012
    Posts
    21
    Quote Originally Posted by msh View Post
    Show us a list of your includes.
    List of includes...do you mean the ones which I added at tools/options/VC++ Directories...?

    Also I am getting several instances of the following error:

    *********
    C:\program files\labpacks\visual c++\include\vclobjects.h(171) : error C3861: 'wcstombs_s': identifier not found
    *********

    Thanks,
    Emma
    Last edited by emmagood; 05-16-2012 at 03:28 AM.

  14. #14
    msh
    msh is offline
    Novice
    Join Date
    Jul 2009
    Posts
    568
    Quote Originally Posted by emmagood View Post
    List of includes...do you mean the ones which I added at tools/options/VC++ Directories...?
    No. I mean your #include directives.
    Disclaimer: This post shows my ignorance at the time of its making. I claim ownership of but not responsibility for all errors in it. Reference at your own peril.

  15. #15
    Registered User
    Join Date
    May 2012
    Posts
    21
    OK... there are several files in the program which are included in the main file. So i am just collating all the #includes from the files

    #include <afxwin.h>
    #include <afxext.h>
    #include <afxcmn.h>
    #include "resource.h"
    #include <CSLScope.h> // most probably from plotlab setup; used for plotting the graphs of data
    #include "stdafx.h"
    #include <fstream.h>
    #include <math.h>
    #include <string.h>



    Presently I am getting the error :

    c:\program files\labpacks\visual c++\include\vclobjects.h(99) : error C3861: 'wcstombs_s': identifier not found

    whereas the file vclobjects.h exists at the location.

    Thanks,
    Emma

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Trying to include a libary in Visual Studio
    By Swerve in forum C++ Programming
    Replies: 1
    Last Post: 02-21-2010, 08:35 PM
  2. header path & include
    By dontoo in forum C++ Programming
    Replies: 3
    Last Post: 02-19-2010, 04:40 AM
  3. include library header in header files
    By Raison in forum C++ Programming
    Replies: 6
    Last Post: 09-27-2004, 02:50 AM
  4. MS Visual C++ 6 wont include vector.h in a header file
    By bardsley99 in forum C++ Programming
    Replies: 9
    Last Post: 11-06-2003, 11:05 AM
  5. Header files in visual studio
    By Shadow12345 in forum C++ Programming
    Replies: 1
    Last Post: 03-18-2002, 10:20 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21