Have never used eclipse, so bear with me. Are header files not part of the standard c/c++ eclipse download? Can't find them anywhere when trying to specify the path for the includes. Any help would be great, thanks.
Related
While programming in NetBeans, I downloaded all the right compilers. C worked fine for me.
But now that I started working with C++, I realized that while opening a new source file C++ with the extension .cpp the NetBeans goes to the C compilers, and then can't find include such as <iostream> etc.
But when opening the file with the extension .c++ the NetBeans does go to the right directory and does recognize everything C++ related. Is there any way to change that so that the extension .cpp will also go to the right directory?
Thank You!
By default, NetBeans does treat .cpp files as C++ source code. The file extension mappings are configurable, so it is possible that they are different or corrupt on your machine. To change them do the following:
Select Tools->Options
Click the C/C++ category.
Click the Other tab
Verify that "cpp" is in the C++ File Extensions list. If it is missing, add it.
Verify that "cpp" is not in the C File Extensions list. If it is present, remove it.
Click OK
Maybe restart NetBeans
Hey this is probably a really easy beginner question but I'm trying to use the library Audiere to play some music files in Qt. I tried to install the library the way the tutorial said(i.e put the header file in MinGw's Include folder.
Yet i Keep getting the same error message:
cannot find -laudiered
So my main question is can you guys teach me how to install a library on windows? I don't really understand the qmake stuff so i just use the Qtcreator IDE to compile and run my program.
Thanks.
Including the header only provide's the library's declarations, which is fine for the compiler. You're getting a linker error because you haven't told it where to find the library's binary implementation files (.lib for static libraries on Windows).
You need to inform the linker of where to locate the necessary files. Most libraries will provide information on this in their documentation, but you can also try locating them yourself in the library's folders.
I downloaded and had a quick look at Audiere. The file you need to link to is in the /lib folder.
See this question for how to do it in QT Creator.
I was always using QtCreator for OpenCV but a new project started with a friend needs to be done with eclipse.
I did all things I usually do with QtCreator but I am facing a strange problem. Although I did set the include path (/home/opencv/include) when I try to compile I get errors for missing headers (i.e opencv2/core/core.hpp). In the project explorer under include tag the only headers appear are the ones in the first level of the included directory. This means that cdt does not include headers recursively.
Is this a bug or I have to include every single directory?
I had the same problem yesterday. It searched all around forums but nobody could answer me. Finally I realized that I was doing the include for the whole project and including files for the project is not the same as including files for the source file "source.cpp" (for eclipse, because for VisualStudio it is the same).
So try to rightclick on the .cpp file and include the directories for it. Anyway, if you tell me which version of OpenCV you're using I can tell you more aspects of how to include files in case you keep having troubles.
I hope it helps. When you get errors about missing headers is always related to include. At least it happened to be like this in my case.
If the include path in Eclipse is /home/opencv/include , we assume that inside this directory you have 2 folders: opencv and opencv2.
On your source code you must reference the headers as:
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
Does that makes sense to you?
Nevertheless, there are several tutorials that can help you configure Eclipse.
I had this problem, too. I think what you need to do is to include the path opencv/build/include, not opencv/include. That's where all the header files are.
How do I properly include libraries in C++? I'm used to doing the standard libraries in C++ and my own .h files.
I'm trying to include wxWidgets or GTK+ in code::blocks and/or netbeans C/C++ plugin. I've included ALL libraries but I constantly get errors such as file not found when it is explicitly in the include!
One error: test1.cpp:1:24: wx/msw/wx.rc: No such file or directory : Yes the .h file library is included; what am I missing?
Do I need to be importing other things as well? Is there a tutorial for this? Obviously my shoddy textbook hasn't prepared me for this.
Firstly, header files are not the same thing as libraries. A header is a C++ text file containing declarations of things, while a library is a container for compiled, binary code.
When you #include a header file, the compiler/IDE needs to know where to find it. There is typically an IDE setting which tells the compiler where to look, or you can do it from the command line, normally using the -I switch. It sounds to me as if you have not set up the path to search for header files on in your IDE.
This means that test.cpp included "wx/msw/wx.rc" but that file cannot be found by your compiler. How to fix this depends on your compiler, but you need to find where wxwidgets is installed and add that to your "Include Paths" so that your compiler knows where to search for it. You can also put a more complete path to it in the include directive.
If the files are present in the same directory as test1.cpp, then probably you use the wrong kind of include. #include <...> is usually used for code that resides outside of the directory that your project is in. #include "..." is for includes inside your project directory (and then if they aren't found there, search in the same places as #include <> would).
It is quite an old question and this didn't really answer it for me.
I reinstalled wxwidgets into the root directory as someone suggested that being in a directory with a space in the name may be part of the problem.
Then I went into project > build options > search directories and removed all entries pointing to original install.
And this fixed the problem
When I compile and run programs in Bloodshed I save everything into a a folder labeled C++ in my username folder. When I downloaded FLTK, extracted it to the C++ folder, then tried to run a program using header files from FLTK, it was unable to find the files. My guess is that when the compiler looks for the header files it's only looking in the C++ folder, and the FLTK header files are embedded in folders that are inside of the C++ folder.
I googled around for a way to somehow have file paths that include looks into when it looks for the specified header file, but I couldn't find anything. Does anyone with experience using Bloodshed know how to do this?
Most people here probably don't use DevC++, having been warned off it by people like me. DevC++ has lots of problems and is no longer being developed. You should consider
switching to Code::Blocks, which is better in just about every way.
If you have installed FLTK properly, you should now have a program called "fltk-config". That program needs to be in your PATH. You need to edit your project's settings so that the output of "fltk-config --cflags" is added to your list of compiler flags and so that the output of "fltk-config --ldflags" is added to your list of linker flags.