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>
Related
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"
#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.
One of my script file(.scnp)included the following headers as follows.
#include <stdio.h>
#include "kel.h"
#include "process.h"
#include "sigtypes.h"
#include "ScriptInterface.h"
#include "../saf/SAF_Scripts.h"
This type of header files include gives an error in GDB saying
"symbol lookup error: /xxx/xxxx.so: undefined symbol:
_Z16KEL_MEM_AllocateP19KEL_MEM_tPoolHandlej.
Included file after
#include <stdio.h>
#include "ScriptInterface.h"
#include "kel.h"
#include "process.h"
#include "sigtypes.h"
#include "../saf/SAF_Scripts.h"
ScriptInterface.h
extern "C"
{
#include "kel.h"
#include "process.h"
#if defined()
#include "sigtypes.h"
#endif
}
The scripts run successfully. What could be the problem? I have found the responsible method for this problem by using "c++filt" but don't know how to proceed further. Please help
I've been getting this error "error C1189: gl.h included before glew.h" though my includes seem to be in the right order.
I also get a 9 warnings saying "warning C4005: 'APIENTRY' : macro redefinition"
I think it may be note worthy to say that I didn't get error before switching to GLFW 3, previously I was using GLFW 2. Below is the include at the top of my "Core.h".
//External Libraries
#include <GL/glew.h>
#define GLFW_INCLUDE_GLU
#include <GLFW/glfw3.h>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
//Default Libraries
#include <cassert>
#include <stdexcept>
#include <cmath>
#include <list>
#include <iostream>
#include <string>
#include <sstream>
#include <windows.h>
I figured it out what seems to have happened is that I had a circular dependency which was also including glfw twice.
I have the following "includes" file in my project.
#pragma once
//glm
#include <glm\glm.hpp>
#include <glm\ext.hpp>
#include <glm\gtc\matrix_transform.hpp>
//glew
#include "GL\glew.h"
//glfw
#define GLFW_DLL
#include "GLFW\glfw3.h"
//libpng
#include <png.h>
//std
#include <stdio.h>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <list>
#include <memory>
#include <iostream>
#include <fstream>
#include <assert.h>
//boost
#include <boost\filesystem.hpp>
#include <boost\property_tree\json_parser.hpp> /* problem */
//mandala
#include "types.h"
#include "type_traits.h"
#include "hash.h"
#include "macros.h"
When I include <boost\property_tree\json_parser.hpp>, I get many errors indicating that I'm redefining APIENTRY such as this one:
1>c:\program files (x86)\windows kits\8.0\include\shared\minwindef.h(130): warning C4005: 'APIENTRY' : macro redefinition
I'm perplexed as to why this is happening. I've tried to suppress the minwindef.h file from being processed by putting #define _MINWINDEF_ before the include statement but to no avail. Has anyone else encountered this or have any idea how I can properly include this boost library?
NOTE
Since youd did neither update your question to reflect the changes to the includes you made, nor provide the whole warning message, I can only guess:
You still have glfw.h included before the boost lib that includes the WinAPI header. Because when I just google for "APIENTRY redefinition", I get this SO question as first result, including the answer: Put the WinAPI header (or the boost header includign them) before the glfw.h include.
You may want to include also ptree.
#include <boost/property_tree/ptree.hpp>