Posts

Showing posts from October, 2015

'atlbase.h': No such file or directory

Image
Error code: #include <atlbase.h> Error: 1    error C1083: Cannot open include file: 'atlbase.h': No such file or directory 2    IntelliSense: cannot open source file "atlbase.h" This error occurs if you are using atlbase.h file in your program in Visual C++ Express Edition instead of Visual Studio. The reason is express edition does not come with Microsoft Platform SDK as studio does so we need to install it separately and need to modify a couple of lines. Solution: 1. Download and install Windows Server 2003 SP1 Platform SDK from http://www.microsoft.com/en-us/download/details.aspx?id=6510 2. If you have a 64-bit OS/Processor (Intel i5, Windows 7 64-bit) then install PSDK-amd64.exe as other two won't work. 3. Go to your installation directory to edit atlbase.h file, default would be C:\Program Files\Microsoft Platform SDK\Include\atl 4. Make following changes

Database login error in Visual Studio

Image
Error: Cannot open user default database. Login failed. Login failed for user 'abcxyz'. I got this error in my Visual Web Developer 2010 Express. My database named Database1.mdf was not opening and throwing this error.

Memory usage per process in C++

Image
Code: #include <windows.h> #include <stdio.h> #include <psapi.h> void PrintMemoryInfo( DWORD processID ) {     HANDLE hProcess;     PROCESS_MEMORY_COUNTERS pmc;     printf( "\nProcess ID: %u\n", processID );     hProcess = OpenProcess(  PROCESS_QUERY_INFORMATION |         PROCESS_VM_READ,         FALSE, processID );     if (NULL == hProcess)         return;

Name must be a namespace name error in Visual C++

Image
Following error was observed in Microsoft Visual C++ 2010 edition while using std namespace. Error: IntelliSense: name must be a namespace name Problem code: using namespace std ; Solution: #include <iostream> using namespace std; This Visual C++ IntelliSense error occurs when you write using namespace std before including a standard header that defines the std namespace, so the compiler has no namespace to refer to. Adding the relevant include, such as iostream, before the using directive resolves it. Order matters: headers must be included so the names they declare exist.

PCH Warning in Visual C++

Image
The following error was observed in Microsoft Visual C++ 2010 edition. Error: Error: PCH Warning: header stop cannot be in a macro or #if block. An intellisense PCH file was not generated. Problem code: [file name : perCoreUsage.h]  #ifndef perCoreUsage #define perCoreUsage void perCoreUsageCall(); #endif Solution-1 Add the following line in your header file perCoreUsage.h: #pragma once Solution-2 Use your header file in some CPP file like perCoreUsage.cpp or main.cpp: #include "perCoreUsage.h" This Visual C++ IntelliSense warning, header stop cannot be in a macro or if block, means the precompiled header boundary fell inside an include guard or conditional, so no precompiled header was generated. Moving the include guard, or restructuring the header so the first includes are not wrapped in the conditional, lets the precompiled header build again. It affects IntelliSense rather than the final compiled output.