sal.h not including when it is in Path - c++

I'm working on implementing DirectSound into a program, but it requires dsound.h which requires sal.h, and for whatever reason I'm having trouble getting g++ to recognize the fact that I have sal.h and it is in the path file and I can even type in the direct command sal.h and command prompt will open sal.h. But when I compile with
g++-3 World.cpp -c
I get
dsound.h:13:17: sal.h: No such file or directory.
followed by thousands of errors from dsound.h resulting from the lack of sal.h. I'm just using notepad, g++, and command prompt, do I need to be in VC++ for sal.h to work? Is there any way to use DirectSound without it?
Here's the opening to the code I'm compiling, just in case:
#include "WorldEntity.h"
#include "MBox.h"
#include <D3D9.h>
#include <d3dx9.h>
#include <string>
#include <sstream>
#define _USE_MATH_DEFINES
#include <math.h>
#define KEYDOWN(vk_code)((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0)
#define KEYUP(vk_code)((GetAsyncKeyState(vk_code) & 0x8000) ? 0 : 1)
using namespace std;
World::World()
{
//Etc
Here is the beginning of WorldEntity.h, the included file that includes dsound.h:
#ifndef WORLDENTITY_H
#define WORLDENTITY_H
class Entity;
class HUD;
#include "Enums.h"
#include "Object.h"
#include "Inventory.h"
#include "AI.h"
#include "Item.h"
#include "Sector.h"
#include "MBox.h"
#include "Particle.h"
#include "Sprite.h"
#include <windows.h>
#include <windows.h>
#include <mmsystem.h>
#include <mmreg.h>
#include <dsound.h>
#include <string>
#include <D3D9.h>
#include <d3dx9.h>
#include <cstdlib>
#include <ctime>
using namespace std;
enum FontIndex
{
//Etc

The command path is not the same as the include path. You have to add the -I flag to GCC to tell it where to find header files:
g++-3 -IC:\some\path World.cpp -c

Related

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"

Trouble with including external directories in C++ with ViconDataStreamSDK

#include <iostream>
#include <cassert>
#include <vector>
#include <algorithm>
#include <functional>
#include <limits>
#include <math.h>
#include "DataStreamClient.h" //[x]
#include "stdafx.h"
using namespace ViconDataStreamSDK::CPP;
{ ...
This is the start of my file that uses the header file ViconDatastreamSDK.h but in every instance that a class from the file is called Visual Studio gives the error:
'ViconDataStreamSDK': is not a class or namespace name
The solution explorer shows that the file is included in the external directories.
How do I get VisualStudio to recognize these classes?

reordering includes causes runtime error

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

gl.h included before glew.h?

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.

Compile errors when attempting to link <boost\property_tree\json_parser.hpp>

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>