I linked boost to my project and using namespaces from boost/asio. Everything is compiled, but vscode cannot find the next namespaces:
using boost::asio::awaitable;
using boost::asio::co_spawn;
using boost::asio::use_awaitable;
namespace this_coro = boost::asio::this_coro;
So there are a red lines and Intellisense doesn't work for these namespaces.
Code works!
I have solved this problem by changing cppStandard from gnu++17 to gnu++20 in c_cpp_properties.json
Thx!
Related
I have been using OpenCV 3.0 that are combined with the extra modules using CMake 3.5. I am using Visual Studio 2012 32bit as my IDE.
However, i cannot seem to use both KeyLine and also BinaryDescriptor. They give me error which is "identifier KeyLine is undefined". I have set the Paths and also library setting.
#include <opencv2/opencv.hpp>
#include <opencv2/line_descriptor.hpp>
#include <iostream>
using namespace std;
using namespace cv;
int main( void ) {
Ptr<BinaryDescriptor> bd = BinaryDescriptor::createBinaryDescriptor();// this line gives error
vector<KeyLine> lines; // same as this
}
I have tried the other header, for instance the tracking.hpp. I am able to define:
Ptr<Tracker> tkr;
Without having the Tracker giving me error.
Anyone know if the error is caused during CMake process or i miss out something?
I just had the same problem, and stumbled upon your question.
The answer I just found out is you have to add,
using namespace line_descriptor;
at the top along with cv namespace.Got this hint from line_descriptor.hpp source code.
CodeLite 7.0, Windows 7, MinGW installed, autocomplete cannot find anything c++ related. I have a workspace and a project in it (just started with CodeLite).
When I try to include a c++ header (e.g. string or vector) or use those classes in my code i get no autocomplete. Compiling and running works fine, just the autocomplete does not.
Under CodeLite->Settings->Code Completion->CTags there is a list of MinGW's include folders for c++ (I checked, all headers are in those folders).
Am I missing something?
What happens when you go to :
CodeLite -> Workspace -> Retag Workspace (full) , does it change anything?
And just to make sure: you do have a workspace and project, right?
Eran
I may be way off base here, but found a similar (same?) issue.
This does NOT work:
#include <vector>
using std::vector;
vec (No autocomplete)
However, both other ways work as expected:
#include <vector>
std::vec (Yes autocomplete)
OR:
#include <vector>
using namespace std;
vec (Yes autocomplete)
I'm running on a CentOS 6.5 x64 OS and have used yum to install armadillo. I'm developing in Eclipse CDT
I've included the armadillo header in the project properties >> C/C++ Build >> Settings >> GCC C++ Compiler >> Includes >> Include files. The entry is: "/usr/include/armadillo"
The header file I am working on recognizes armadillo and the include statement isn't flagged for any errors or warnings.
Below is the code:
#include <armadillo>
using namespace std;
using namespace arma; // arma is not recognized as a symbol
const double DEGREES_PER_RADIAN = 180.0 / datum::pi; // datum is not recognized
I've checked the file /usr/include/armadillo and it does include the namespace arma section.
//! \namespace arma namespace for Armadillo classes and functions
namespace arma
{
// preliminaries
...
I've also checked the permissions and the /usr/include/armadillo file is readable to all users.
The problem is when I add the "using namespace arma", CDT marks it as an error and says that "Symbol 'arma' could not be resolved".
At this point, I don't have any other ideas to figure out why the namespace isn't recognized. Any insights or pointers to figure this out would be much appreciated.
This question's answer provided the answer to my issue:
Clean Eclipse Index, it is out of sync with code
Josh Kelley's answer from the linked issue:
Right-click on your project, go under the Index submenu, and choose either "Rebuild," "Update with modified files," or "Freshen all files."
I don't know the difference between those three options, but one of "Update with modified files" or "Freshen all files" usually fixes it for me.
Also, I'm sure you've already done this, but make sure that you're running the latest version of the Eclipse CDT. Current versions seem to have much more reliable indexing than previous versions.
After running Index >> Rebuild and Index >> Freshen All Files, the errors were gone.
I am just a beginner in C++. I have errors with namespaces in Visual C++. Here is the code which include files I have to add for this foundation. The error says the name must be a namespace name. I add whole code is source folder. There is not single file in header. Wow many files do I have to add?
using namespace System;
int main()
{
if (Environment::HasShutdownStarted)
Console::WriteLine("Shutting down.");
else
Console::WriteLine("Not shutting down.");
return 0;
}
You should add this:
#using <mscorlib.dll>
If you want to use System namespace. Hope this helps.. :)
Try adding this:
#using <mscorlib.dll>
It is used to let the compiler know you are working with the system.
I am building a Makefile project in Eclipse Juno, and I have it set up so it compiles and debugs (it's using CMake, so I'm not using the internal tools). However, Eclipse obviously hasn't been informed of the right headers, as in the following code:
#include <iostream>
using namespace std;
int main ()
{
cout << "Hello world << endl;
return 0;
}
the include "iostream" and symbols "std", "cout" and "endl" are all unresolved.
How should I make Eclipse aware of these so it will stop underlining everything in red and spamming with errors?
This can be resolved by specifying the following environmental variables in Project->Properties->C++ Build->Environment.
LANG=en_US
LC_ALL=en_US
Apparently they are needed for the auto-discovery tools to work out where the includes live.
Answer gleaned from this Eclipse forum thread.