CodeLite autocomplete cannot find c++ headers - c++

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)

Related

how to include aspose.pdf.cpp in vs c++ project?

I am trying to implement this basic example https://docs.aspose.com/pdf/cpp/hello-world-example/ but I am getting errors that MakeObject, Document and TextFragment are not defined.
I was developing on vscode but then I realized that aspose can be downloaded through nuget in vs so I switched to vs thinking that adding aspose will be automatically integrated in my project dependencies or something, but no it didn't and I don't know currently how to include it (my use case is also very basic I tried hummuspdf/PDF-Writer but also I didn't knew how to implement it or include it, maybe it isn't as simple as #include "file.h" ? )
#include "Aspose.PDF.Cpp/Document.h"
#include "Aspose.PDF.Cpp/SaveFormat.h"
using namespace Aspose::Pdf;
using namespace System;
int main()
{
auto doc = MakeObject<Document>(u"Example.pdf");
doc->Save(u"Example.docx", SaveFormat::DocX);
}

Including <string> in c++ using Netbeans

Netbeans fails compilation on:
#include <string>
Output says:
main.c:10:18: fatal error: string: No such file or directory
#include <string>
The previous two declarations are included fine:
#include <stdio.h>
#include <stdlib.h>
I have removed all the code afterwards to make sure.
I am using cygwin_64 and it installed as per Netbeans c++ installation manual and shows versions in CLI
I am new to C++ and I know there have been similar questions, but the answers didn't help me.
Just try to create new project and follow these steps:
Click File->Create project.
Choose C/C++, then C/C++ application, click Next.
Enter project name and in the right choose C++ in combobox. Or C++11.

CodeLite not working with boost library

I'm having some troubles to get my CodeLite IDE working with Boost library.
So basically, I've got CodeLite v.6.1.1 and Boost library downloaded from sourceforge. I would love to make it actually working, but I failed to do so using the following concept:
I did create new workspace, than I did go -> Settings -> Build Settings -> Compilers (here I have two compilers, one of which is CodeLite 4.8.1 and the other one is MinGW Code::Blocks, I did select CodeLite 4.8.1. -> Advanced -> Global Paths -> and I did provide two blank lines of Include Path and Libraries Path with the directory of unpacked boost library (Windows 7): C:\boostlib\boost_1_57_0.
In this catalog (i.e.: C:\boostlib\boost_1_57_0), I have got all neccesary files, all of them are unzipped and yet I can't get it working.
Besides, I can't click on apply when I'm done with setting path to files containing boost library, all I can do is click ok but once I'm done with this I can't work with libraries from boost.
The following code isn't working:
#include <boost/lambda/lambda.hpp>
#include <iostream>
#include <iterator>
#include <algorithm>
int main()
{
using namespace boost::lambda;
// ERROR MESSAGE: boost/lambda/lambda.hpp, No such file or directory
typedef std::istream_iterator in;
std::for_each(in(std::cin), in(), std::cout << (_1 * 3) << ” ” );
return 0;
}
The message I get is:
boost/lambda/lambda.hpp: No such file or directory
Is there any chance I can get CodeLite working with boost library or should I simply switch IDE and forget about it ?
Your on the right track but need to point to the libs and include folders inside the boost directory.
I use the the http://nuwen.net/mingw.html version of mingw as STL (the guy) includes boost as part of his distribution.
So in codeLite I just have to add
C:\MinGW\lib to the libraries path
C:\MinGW\include to the include path

Use dlib in Visual studio 2012

I want to use optimization algorithm lbfgs in my project but I do not want to code it myself. So I found Dlib is a good option.
http://dlib.net/compile.html is a good library. I downloaded it. I use windows 7 and visual studio 2012. If I create a new win 32 console project and set property->configuration properties->VC++ Directories->Include Directories to the path of Dlib(dlib-18.10/).
And it works fine which mean I can run examples.
But when I add it to my project. I occur errors.(error : "vector" is ambiguous)
I guess it maybe because the way I include it.
On the document of Dlib, it says,
Again, note that you should not add the dlib folder itself to your compiler's include path. Doing so will cause the build to fail because of name collisions (such as dlib/string.h and string.h from the standard library). Instead you should add the folder that contains the dlib folder to your include search path and then use include statements of the form #include <dlib/queue.h>. This will ensure that everything builds correctly.
But I am not clear what it means above. I googled the Visual Studio search path (Tools / Options / Projects and Solutions / VC++ Directories).. But in my project this is non-editable.
I only use optimization.h in dlib. If I delete 'using namespace dlib;', then ' typedef matrix column_vector;'then the error is matrix is not a template. If I keep 'using namespace dlib;' I have error "vector" is ambiguous`.
#include <dlib/optimization.h>
#include <iostream>
using namespace std;
using namespace dlib;
// ----------------------------------------------------------------------------------------
// In dlib, the general purpose solvers optimize functions that take a column
// vector as input and return a double. So here we make a typedef for a
// variable length column vector of doubles. This is the type we will use to
// represent the input to our objective functions which we will be minimizing.
typedef matrix<double,0,1> column_vector;
As the documentation says, include directory should be root directory of the zip you downloaded. Then you include as #include <dlib/vector.h>. However, since vector is defined under namespace of std as well, you should be specifically denote which namespace's STL you will use.
If you want to use std::vector,
#include <vector.h>
then use it as
std::vector<int> stdVar;
Similarly, for dlib,
#include <dlib/geometry/vector
then use it as
dlib::vector<int> dLibVar;
You could also delete using namespace std if you don't use it as frequent as dlib. Then every STL you reference will be dlib. If you want std, just type std::vector.
using namespace std;
using namespace dlib;
#define vector std::vector
use w/ caution

How to create a VTK project in Windows Form Project (VisualC++ 2012 )

I'm trying to embed scene created with Visualization ToolKit (VTK)library into VisualC++ 2012 created windows form so I can design my Windows native GUI interface.
I'd like to underline that, all examples with console app are configured with (Cmake), compiled with VC++2012 and works flawlessly, as instructed by the official VTK wiki page.
The issue is, if I try to call those VTK functions and class initializations inside of Win Form application I get the Error LNK1107: invalid or corrupt file: cannot read at 0x2E0 D:\.....\VTK_61_BUILD_VS2012\bin\Debug\vtkViewsCore-6.1.dll even if I add everything normally as expected, include headers and external library dependencies.
This makes me think that I'm originating from wrong Visual C++ 2012 project template or something obvious that I'm completely missing, otherwise compiler would arise many not found files or syntax error.
This is the first lines where I'm trying to invoke the VTK library, even the intellisense suggest the vtk..... named proc,functions and structures, but application fails to compile.
#pragma once
#include <vtkSmartPointer.h>
#include <vtkTriangle.h>
#include <vtkCellArray.h>
#include <vtkPolyData.h>
#include <vtkRenderWindow.h>
namespace CLR_Project1 {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
...
...
vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
What is the problem here ?
The following link (in particular the answer of Mr. bnsteel) helped me very much, when I had the same problem ==>
http://vtk.1045678.n5.nabble.com/VTK-and-Winforms-integration-td5721086.html
You can use Swig as it is suggested under the link. But it is not necessary. Using the similar way (passing the windows form panel handle) you can create a C++/CLI wrapper as jalal sadeghi proposed. You will pass the panel handle through the wrapper to your C++ library that does all the "VTK work". This way you don't have to create individual wrappers for all VTK classes, all the "VTK work" and dependencies on VTK stay hidden in your C++ layer.
Something like this ==>
C++ side
setImageRenderWindowParentID(void *theID){
... (init your vtk render window)
renWin->SetParentId(theID);
}
C++/CLI side
void setRenderWindowParentID(IntPtr parentID, .. also pass the panel size .. ){
void* p = parentID.ToPointer();
myCPPVTK->setRenderWindowParentID(p, .. also pass the panel size ..);
}
C# side
VTKWrapper.setRenderWindowParentID(m_panel.Handle, .. also pass the panel size ..);