Cannot resolve namespace std in Android Studio - c++

I have a native library for an Android app. When I load the entire C++ project in Android Studio, some errors are thrown by the IDE saying:
cannot resolve namespace std and cannot find any C++ headers.
#include <fstream>
#include <iostream>
#include <map>
using namespace std;
For all of the above code, fstream, iostream, etc is being marked red and shows cannot find. Any workaround to fix the above issue?

Related

Microsoft Visual C++, Visual Studio, How to fix the error: identifier "GetAsyncKeyState" is undefined

I am new to C++, directX and Windows programming.
Here are the header files that I am referencing, and namespaces that I am using:
#include "pch.h"
#include <Windows.h>
#include <iostream>
#include "Common/DirectXHelper.h"
using namespace Windows;
using namespace Microsoft::WRL;
using namespace Windows::UI::Core;
using namespace std;
Here is the line that causes the error:
return (GetAsyncKeyState(key) & 0x8000 != 0);
I do not know if I misspelled something or if it is a compiler issue, I have checked everywhere and have not found the solution.
I have also tried using the GetCursorPos method and it did not work.
Thanks in advance.
Edit:
The error message is:
error C3861: "GetAsyncKeyState": identifier not found
key is an int that has the key code of the key I am testing
Presence of namespace Windows::UI::Core suggests that you are working on UWP application while ::GetAsyncKeyState is only available for "desktop" applications as stated at Requirements documentation section. For UWP applications you can utilize CoreWindow::GetAsyncKeyState.

apache Thrift TNonblockingServer Error

I've been following Thrift C++ wiki tutorial. and everything works fine with TSimpleServer.
But, when I try to implement TNonblockingServer I'm getting this error :(
undefined reference to `apache::thrift::server::TNonblockingServer::serve()
undefined reference to `apache::thrift::server::TNonblockingServer::~TNonblockingServer()
I think its something related to the header files or the namespaces.
The following headers im using:
#include <thrift/protocol/TBinaryProtocol.h>
#include <thrift/server/TSimpleServer.h>
#include <thrift/transport/TServerSocket.h>
#include <thrift/transport/TBufferTransports.h>
#include <thrift/concurrency/ThreadManager.h>
#include <thrift/concurrency/PosixThreadFactory.h>
#include <thrift/server/TThreadedServer.h>
#include <thrift/server/TNonblockingServer.h>
using namespace ::apache::thrift;
using namespace ::apache::thrift::protocol;
using namespace ::apache::thrift::transport;
using namespace ::apache::thrift::server;
using namespace ::apache::thrift::concurrency;
any idea whats wrong?
I understand that this is really late reply.
It is due to missing libthriftnb library for TNonblockingServer.
while Tsimplesever and TThreadedServer are in libthrift library so it was works with you.

C++ #include not working in Microsoft Visual Studio 2010

I have been using Visual Studio and I think I must have messed with some setting. I can't include basic things like <iostream>. How can I fix this?
#include <iostream> // for standard I/O
#include <string> // for strings
#include <iomanip> // for controlling float print precision
#include <sstream> // string to number conversion
#include <opencv2/imgproc/imgproc.hpp> // Gaussian Blur
#include <opencv2/core/core.hpp> // Basic OpenCV structures (cv::Mat, Scalar)
#include <opencv2/highgui/highgui.hpp> // OpenCV window I/O
using namespace std;
using namespace cv;
All the above lines are in red squiggle below. My guess is while trying to configure Visual Studio to use OpenCv, I messed with some setting.
More than likely, you forgot to add 'using namespace std' as pretty much nothing in iostream is really useful without it. If you are getting 'cant find ...', then you have a setup problem and should reinstall Visual Studio because the headers were not properly placed.
Hope this helps, feel free to post your code and I can tell you for sure what the problem is, but that is the most likely of them.

Symbol boost could not be resolved

I am using boost and eclipse as my IDE.
Boost is located in /home/ubuntu/cpp/boost_1_52_0/boost
In eclipse IDE I get a red squiggly line in red that says:
symbol boost could not be resolved-> using namespace boost;
In the ide and eclipse settings I have the includes have the path home/ubuntu/cpp/boost_1_52_0/
specified. Soo..how to I make boost work? What am I missing?
#include <iostream>
#include <stdlib.h>
#include <vector>
#include <string>
#include <time.h>
#include <boost/tokenizer.hpp>
using namespace boost;
using namespace std;

VC++ 10.0 express gdi+ GdiPlusPen.h header

When i include GdiPlus.h,Pen class is undefined.
But GdiPlus.h includes GdiPlusPen.h
...
#include "GdiplusImageAttributes.h"
#include "GdiplusMatrix.h"
#include "GdiplusBrush.h"
#include "GdiplusPen.h"
#include "GdiplusStringFormat.h"
#include "GdiplusPath.h"
...
When i include GdiPlusPen.h myself, it works. Can i use it safely?
Question: is this because of my VC++ being express install?
8 days left until activation prompt :(
Anyone having same problem?
Windows XP sp-3, pentium-m centrino.
No, #including GdiplusPen.h directly isn't correct. The gdiplus classes live in a namespace named "Gdiplus". Either use that namespace explicitly (like Gdiplus::Pen) or make it look like this in your .cpp file:
#include <gdiplus.h>
using namespace Gdiplus;