why #include <iostream> is not used in driver development - c++

#include <DriverSpecs.h>
_Analysis_mode_(_Analysis_code_type_user_code_)
#define INITGUID
//#include<iostream>
#include <windows.h>
#include <strsafe.h>
#include <cfgmgr32.h>
#include <stdio.h>
#include <stdlib.h>
#include "public.h"
When I tried to use <iostream> in a sample driver solution I got an error.
I'd like to know if is it possible to get input or output while a driver is running.

Related

Why does including several libraries throw Runtime Error(SIGILL)?

I was getting SIGILL Runtime Error on one of my codes.
But then i noticed that just changing the libraries used made it run normally.
Previous code(throws Runtime Error on C++14):
#pragma GCC target("avx2")
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <chrono>
#include <random>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <iomanip>
Modified version(Gave AC on C++14):
#include<bits/stdc++.h>
What might be the reason for this?

identifier "CvRTrees" is undefined

I'm using openCV-3.2.0 and getting an identifier undefined error when initializing the line :
CvRTrees rtrees;
I think i have added all the necessary header files. So why am i getting this error?
#include <stdio.h>
#include<conio.h>
#include <opencv/cv.h>
#include <opencv2/highgui/highgui.hpp>
#include <opencv/cvaux.h>
#include <opencv/ml.h>
#include <opencv2/core/core.hpp>
#include "opencv2/objdetect/objdetect.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>
#include <math.h>
#include <windows.h>
#include <string>
#include <stdlib.h>
#include <exception>
#include <array>
#include "opencv2/ml/ml.hpp"
using namespace std;
using namespace cv;
This class exists in OpenCV 2.4.x, However it is not available in newer versions of OpenCV like 3.2.0. Check here the list of all cv::ml classes for OpenCV 3.2.0. I suggest you to use RTrees instead. To do this you do not need to include all headers, just include the machine learning module:
#include "opencv2/ml/ml.hpp"

Visual Studio Professional 2013, Update 5, "No Target Architecture"

I have a CPP project in Visual Studio, I'm getting the following message when I try to build the solution:
1>c:\program files (x86)\windows kits\8.1\include\um\winnt.h(147): fatal error C1189: #error : "No Target Architecture"
The contents of stdafx.h:
#pragma once
#include "targetver.h"
#include <stdio.h>
#include <tchar.h>
#include <ctime>
#include <time.h>
#include <iostream>
#include <profileapi.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <Windows.h>
What's missing?
In the end I found that removing the headers:
profileapi.h
sys/types.h
Resolved the issue and the project now builds without warning or error.
Thank you Dai, the better solution:
#include "targetver.h"
#include <Windows.h>
#include <stdio.h>
#include <tchar.h>
#include <iostream>
#include <chrono>
#include <ctime>
#include <time.h>
#include <fstream>
#include <profileapi.h>
#include <sys/stat.h>
#include <sys/types.h>

Why is SRWLock undefined?

I'm trying to use SRWLock with C++ project Visual Studio 2012 (Windows 7) targeting 32-bit Windows only and SRWLock is better then CriticalSections in my case.
As i've searched, i should include WinBase.h and use std namespace. But SRWLock is still undefined. Couldn't find anything useful on Google. What i'm missing? I appreciate any clues.
Code:
#include <cstdlib>
#include <winsock2.h>
#include <Ws2tcpip.h>
#include <windows.h>
#include <stdio.h>
#include <vector>
#include <iostream>
#include <string>
#include <conio.h>
#include <WinBase.h>
using namespace std;
SRWLock gLock; // here is the problem
Where was a mistype: Should be SRWLOCK instead of SRWLock.
And you need
#include <windows.h>

Weird VC++ Intellisense Behavior

Intellisense is broken with this code, everything is undefined to Intellisense from tree header:
#include "tree.h"
#include <iostream>
#include <ctime>
#include <string>
#include <list>
But when I move my own bst implementation header file down a bit, Intellisense starts working again.
#include <iostream>
#include <ctime>
#include <string>
#include <list>
#include "tree.h"
Why is this?