Configure Eclipse for C++ with Eigen library - eclipse

This might be super silly question - but how do i make my eclipse identify Eigen libraries. I installed Cygwin64 (with devel option which installed Eigen under D:/Cygwin64/usr/include/Eigen3
I included Cygwin root folder in path env variable.
After this, i opened Eclipse for C++ and when i try to include Eigen #include <Eigen/Dense> it says Unresolved inclusion : <Eigen/Dense>
I googled for a while, and tried various options, but not working. How do i make my program include Eigen libraries? (like prj prop --> c++ build --> setting --> link --> misc --> adding eigen folder)
Is there a setting in eclipse where i need to specifically include it in build path?
---Update ----
I did the following
Prop --> C/C++ general --> Paths & Symbols --> GNU C++ --> added Eigen3 folder
after this, the error is changed to fatal error : Eigen/Dense No such file or directory
Appreciate your help!

I wonder if you have a resolution no longer. But I have resolved this problem with the following steps.
1. proj prop -> C/C++ General -> Paths and Symbols -> (GNU C++) Source Location -> Link Folder -> check "Link to folder..." -> Browse -> select eingen3 folder(eg. /usr/include/eigen3) -> OK -> Apply
2. (proj prop -> C/C++ General -> Paths and Symbols ->) (GNU C++) Includes -> Add -> Workspace -> select "eigen3" -> OK -> Apply
3. Click OK and close the Properties window.
The progress bar is moving, and Analyzing is finished, then you can see green terms related Eigen.
I hope this makes you help.

Related

undefined reference to `memcpy'

I strougle a little bit with my eclipse-arm-project. I get the following errors.
undefined reference to `__aeabi_uldivmod'
undefined reference to `memcpy'
I know the right gcc-lib is missing but I don't know which the right would be and how I could configure eclipse correct to use it.
At the moment I have this relating paths in my project-PATH-variable
C:\...\GNU Tools ARM Embedded\Build Tools\2.8-201611221915\bin (for make)
C:\...\GNU Tools ARM Embedded\5_4_2016q3\bin (for arm-none-eabi-gcc)
The 'Build tools folder' and the 'Toolchain folder' are the same as the second path from the both project-PATH-variable.
I tested a lot of stuff and am now totally confused, may I ask for a little help?
I found the Solution:
In the project settings ('C/C++ Build' -> 'Settings' -> 'Tool-Settings' -> 'Cross ARM C++ Linker' -> 'Gernal') the following flags were active and has to be deactivated.
Do not use default libraries (-nodefaultlibs)
No startup or default libs (-nostdlib)

How to link to pistache in Eclipse C++

I fail to link the pistache library in Eclipse C++ on my Ubuntu machine. I already make this reference:
Properties > C/C++ Build > Settings > Tool Settings
Under GCC C++ Linker > Libraries > Library search path
Under GCC C++ Compiler > Includes > Include paths
Add /usr/local/include/pistache to each
It throws a bunch of errors like this:
.... undefined reference to `Pistache::Ipv4::any()'
Why does this fail? The autocomplete is able to see the reference when I try rewrite the whole line, but it still errors out.
You have to let the linker use shared libraries and pass the -fpic option to the compiler:
a. First step -shared, see this image
b. Last Step Position Independent Code -fPic, see this image
Update
Another way to solve this is:
a. Add support for pthread to the linker
b.Add pistache to libraries in the linker

Eclipse and PHPUnit: "The import PHPUnit\Framework\TestCase cannot be resolved"

I'm starting with PHPUnit, and it works fine so far. I just got one problem:
Eclipse (Oxygen.3) is telling me in this line:
use PHPUnit\Framework\TestCase;
"The import PHPUnit\Framework\TestCase cannot be resolved"
I went to Window -> Preferences -> PHP -> Tools -> PHPUnit and added the path to my phpunit.phar. But this didn't help.
I went to Window -> Preferences -> PHP -> Source Paths -> Libraries and tried to import my phpunit.phar. But this results in an error "The selected file is not a valid user library data file".
Any other ideas how to get rid of this error?
I was having the same problem and this solution worked for me:
Going into Project > Properties
Under PHP > Include Path, pick the "Libraries" tab.
On "Add External PHARs..." select the PHPUnit framework file on your system (phpunit.phar).

Threads in Eclipse AND c++11

My goal has been to create multi-threading programs, and I can not even get a simple thread
to execute ON ECLIPSE CDT. my Tools:
ECLIPSE 3.8.1 CDT
Ubuntu 13.10
I have noticed very similar issues regarding mine. I have tried those other solutions but I could not get them to work for me.
When I type the code in Eclipse CDT, Eclipse does not 'resolve' the symbols 'thread', however, It can find the header file 'thread'. 'Mutex' also does not resolve. Furthermore, after building, I run the program, eclipse returns :
"terminate called after throwing an instance of 'std::system_error'
what(): Enable multithreading to use std::thread: Operation not permitted"
Some additional notes:
I can compile and execute the code in the terminal using:
'clang++ c.cpp -pthread -std=c++11'
but...
'g++ c.cpp -pthread -std=c++11' compiles and
produces the same error as quoted above. So it looks like it's a compiler issue. I did
start to write the code in a new project within Eclipse CDT with the clang++ compiler and now that gives the same non-resolved 'thread' and produces the error as quoted above. So now I think I have some wrong settings, paths or flags set in Eclipse.
include <iostream>
include <thread>
using namespace std;
void p1(){
cout<<"process 1 is processing"<<endl;
}
int main() {
thread t1(&p1);
cout<<"Hello from main()"<<endl;
t1.join();
return 0;
}
I have been struggling with the very same issue and I finally resolved it. Here is what I did:
1) Add -std=c++11 for c++ build. To do that right-click your project, select properties and then: C/C++ Build -> Settings -> GCC C++ Compiler -> Miscellaneous(last option)
In other flags append -std=c++11. My Other flags now looks like: -c -fmessage-length=0 -std=c++11 but yours may be a bit different.
2) Add some linker options. In the same view(C/C++ Build -> Settings) as above select the GCC C++ Linker option and from there go to Miscellaneous(second to last option). Add the following Linker flags(the field was empty for me): -Wl,--no-as-needed -pthread. Hit apply.
3) Add a macro. Again from the project properties menu(project->right click->properties). Navigate to C/C++ General -> Paths and symbols -> Symbols. Select GNU C++. Add a symbol with the name __GXX_EXPERIMENTAL_CXX0X__ and no value. Again hit apply.
4) Navigate to C/C++ General -> Preprocessor Include paths.. Select the providers tab. In this tab leave only the following two options checked: CDT GCC Built-in Compiler Settings and CDT Managed Build Setting Entries. Select CDT GCC Built-in Compiler Settings uncheck the checkbox Share setting entries between projects(global provider) and now the text box labeled Command to get compiler specs should be enabled. In this text box append the good old -std=c++11. The text now looks like this for me ${COMMAND} -E -P -v -dD ${INPUTS} -std=c++11. Hit apply one last time.
5) Rebuild the index for the project. To do that right click the project->Index->Rebuild
Following these steps I was able to compile a c++11 multithreaded program, execute it and also Eclipse CDT did not report any errors and was helpful with the autocompletion. Unfortunately this setting has to be done separately for Release and Debug(or at least I have not found a way to share it). Hope this helps.

Eclipse CDT can't add .h files to path automatically

I use Eclipse CDT develop a C project in Windows.When i build the project, it throws some errors said the c file invoke .h files these file can't find. But actually, these files are available, it looks like the Eclipse CDT can't add them path? why not CDT add them to path automatically, like java? The make file is generated by Eclipse, i'm just begin to use Eclipse CDT, who can help me?
No, you need to add the paths as follows (covering a little bit more than what was asked) :
See gcc man page :
-L : Add a directory to the list of directories to be searched for -l
-l : The name of the library to be searched (without lib* prefix and extension)
For example: libmylib.a would be linked using linker option -lmylib
and :
-I : Add a directory to the list of directories to be searched for header files.
Each of those options can be repeated several times when passed to the compiler.
In CDT :
To configure includes : "Project > Properties > C/C++ Build > Settings > GCC Compiler > Includes"
To configure libraries : "Project > Properties > C/C++ Build > Settings > GCC Linker > Libraries"
Those configurations are also available in "Project > Properties > C/C++ General > Paths and Symbols > Includes/Libraries". Same rules as above.