OpenCV setup in eclipse - c++

I setup eclipse IDE to use openCV. I followed the tutorial provided on openCV website. However, there is this extremely annoying issue am facing every time I create a new project. It seems I need to redo the entire process of pasting the library files in GCC C++ linker for every project that I create. Is there anyway of making them persistent for all new projects ? Or to at least be able to export the settings so that I can import them which will save time.
Thanks

I may have misunderstood the question, but if you just don't want to set up the project each time, you can save a build configuration in Eclipse.
To use another projects build configuration:
Project -> Properties -> C/C++ Build
Click Manage Configurations and create a new config (call it opencv or whatever).
Then set up your Includes, GCC linker etc as you have done before. Then hit Apply.
Now if you ever want to set up a new project with these configs, select your new project:
Project -> Properties -> C/C++ Build -> Manage Configurations
Click New and select 'Import from projects' and select your 'opencv' configuration. This will import the build set-up into the your new project.
Then just select it from the Configuration drop-down.
To export the build configuration as an XML file:
Right click project -> Export...
Select C/C++ -> C/C++ Project Settings
Select the Configuration you want to export and save it somewhere.
To import it into a project:
Right click project -> Import... -> C/C++ Project Settings
and browse for your config file
Hope this helps!

Related

eclipse cdt - change type of project

I have a bunch of Eclipse projects imported into my workspace.
I know how to add a directory for Eclipse to search for headers to resolve symbols.
However, some of my projects do not allow me to add these directories and I realized that it's because those projects are not the correct type.
Right click > Properties on the 'correct' type of project shows an item in the list called "C/C++ Build
If it has this entry, then in C/C++ General it has an entry called Paths and Symbols wherein I can add necessary include directories so that the indexing works.
QUESTION
How do I change the properties of this project so I can use indexing and add directories for indexing?
I've found one thing that obviously needs to be changed: in the 'correct' project, Right Click > Properties > Builders has two entries: CDT Builder and Scanner Configuration Builder while the 'incorrect' project is missing these two.
How do I add them?
Import yields a blank page and New is just as useless.
You probably want File -> New -> Convert to a C/C++ Project (Adds C/C++ Nature).

Handling different build scenarios in Eclipse for C project

I am working on embedded c project. Till now I was using batch files and cmd prompt to compile the source files. Now I am planning to use Eclipse IDE for editing the code and compilation. The folder structure is as follows (refer the image)
Delivery folder remains same for all build scenarios since it contains the main module source files.
Test_Setup folder contains the test cases. Each TAxx had src and inc folder. In each TAxx_src folder, there is a .c file containing main function and and test functions. Currently using batch files for testing there is a batch file for each TAxx folder (in this case 4 batch files) which will compile the Delivery folder and the corresponding TAxx folder.
In eclipse I want to keep the same folder structure. But if I give build, eclipse will throw multiple "main" error. Hence I am unable to give build directly.
There is also a possibility of creating build configurations in eclipse. But since TAxx can be in 100s it will be difficult to create so many build configurations and maintain it.
How to effectively handle such a build scenario in eclipse. My task is to keep the folder structure same and while giving build, I must be able to select which TAxx folder I want to use for build.
Keeping the same folder structure, how can I compile Deliver folder and anyone TAxx folder?
Is there an option to create build configurations automatically?
After project is successful and all test cases are executed, the source code in moved to configuration management, but the eclipse project is not stored. Is there an option to export build configurations in a file so that it can be used when the project is again loaded in Eclipse?
Regards
Manoj
Left click in the Project Explorer tab -> New -> C Project
A C projet will be created with 2 build configurations as default: Debug and Release.
Left click on your project just created.
Right click -> New -> Folder
This way add all your folders according to your Project structure.
Go to Properties -> C/C++ General -> Source location tab -> Add folder button
Then select both folders available resulting in the following Project layout:
Go to Properties -> C/C++ General -> Includes tab -> GNU C Language -> Add button
And finally add all your include paths resulting as follows:
To select which folders to be used for compilation, you rather have to select the folders that will be excluded from build. To do this right click on folder to exclude -> Resource Configurations -> Exclude From Build -> select the build configuration
This way building is acomplished as required in your bullet 1 and 2 questions.
Bullet 3 - It is possible through makefiles, although it's trickier then letting eclipse manage the build process.
Bullet 4 - Build configurations are already stored in the Project, so when you load it again will be there available again.
If you want to creat more build configurations right click in the Project, Build Configurations -> Manage -> New -> Copy settings from Existing Configuration
But in my opinion you don't need to create hundreds of build configurations in your case. Maybe just the 2 regular ones, Release and Debug are enough. Selection is made by choosing which TAxx folder will not be excluded from build.

Reset property page settings Visual Studio C 2010 Express

I made some changes to the Property Pages/Configuration Properties a long time ago and I'd like to reset them. I changed stuff like the output directory, code generation settings, etc.
I've tried resetting all environment settings from the Import and Export Settings Wizard. I've also tried the devenv /resetsettings command. Both of which did not work. Reinstalling doesn't work either. May I get some advice on how to restore everything back to the default.
Thank you.
If I understand you correctly, you are trying to revert to old settings for the Project -> Properties.
This information is stored in the project itself, not in Visual Studio. Look for a file with the extension vcxproj in the solution folder.
You can edit it with Notepad (notepad++), or - you can edit it inside Visual Studio, by
right-click the project, unload it, then edit project file, then reload project
Be careful how you edit these settings.
For best results, create a new solution, with a new project, and compare the settings from the newly created project with the existing one.
edit: on my computer (I have VS Ultimate I think, but it shouldn't matter):
To edit, go to Project -> Properties -> VC++ Directories, and on each, at the end of the line, press the arrow down, and click Edit...
VC++ directories:
$(VCInstallDir)bin
$(WindowsSdkDir)bin\NETFX 4.0 Tools
$(WindowsSdkDir)bin
$(VSInstallDir)Common7\Tools\bin
$(VSInstallDir)Common7\tools
Include Directories:
$(VCInstallDir)include
$(VCInstallDir)atlmfc\include
$(WindowsSdkDir)include
$(FrameworkSDKDir)\include
from what I see in the directions you pointed out, all you have to do is remove from your list, the directories that you no longer want.
In c/c++ -> Code Generation ->
enable minimal rebuild: NO
enable c++ exceptions: YES (/EHSC)
Basic Runtime Checks - Both
/MTd
...
General -> Output directory:
not sure what is the default, I would put something like
$(SolutionDir)bin\$(Platform)\$(Configuration)\
Also, there seems to be a property sheet that may have been added to your project...
You can generally see the Property Manager from View -> Properties Window (F4).
here, you can expand the project configurations, and simply delete any property sheets you may not want (I expect a new project to have no property sheets).

The program file specified in the launch configuration does not exist

I am facing some problems regarding eclipse for c/c++. I am trying to create a new project, I provide the code, and after running the code I get this error:
The program file specified in the launch configuration does not exist
C:\Users\elisabeth\workspace\mm\Debug\mm.exe not found
Please notice that I am working with spice toolkit; I set the path for the "include" files and the libraries, but still I can not have a result.
What causes this error and how can I resolve it?
Right click on your project --> Properties
Run/Debug settings
Delete whatever is set as "launch configuration for '........'
Project --> Clean
Project --> Build Project
You can create a run configuration. Go to Run > Run Configurations. Click New button, fill C/C++ Application field, i.e., insert path to your executable. The new configuration will appear in the list which appears when you click to the arrow next to run button.
Of course this assumes your can build without problems, otherwise you won't see an executable to point to.
You can clean the project, build it again and run it as a local C/C++ application. Simplified steps as follows,
Right click on the project
Clean Project
Again Right click on the project
Build Project
Again Right click on the project
Run As ->
Local C/C++ Application
As the error reads:
C:\Users\elisabeth\workspace\mm\Debug\mm.exe not found
First of all you need to check whether there is an executable "mm.exe" in your Debug folder. (Of course, it is not there and that is why the error)
Go to Project > Clean
and you should see some files being deleted from your Debug folder
Go to Project > Build Project
and you should see some new files being generated e.g. mm.d, mm.o, mm. This "mm" is probably the executable you're looking for
Now that you know what your executable is, you should tell eclipse what file to execute instead of mm.exe. Go to Project properties and in run debug settings create a new configuration (or edit an existing configuration, if there is one already). In this configuration, in main tab, in C/C++ Application specify a full path to "mm". Which, in your case is - "C:\Users\elisabeth\workspace\mm\Debug\mm"
A better way to do this in eclipse is:
${project_loc}/"your folder"/"your executable file"
e.g.${project_loc}/Debug/mm
what worked for me is file->refresh
then do the Debug configuration again by choosing the right c/c++ binary again.
Avoid troubles with configuration by going into Project properties > C/C++ build > Refresh Policy and specify your project folder. The configuration option "Search project" will show a correct folder then and you will see whatever you build there - Debug, Release or both. You don't want to specify the folder using Browse option every time you import project or switch configurations.
As this is the first SO discussion that appears for this topic on Google and none of the answers solved the problem my students were having, I would like to mention the solution we eventually found from this answer:
Open project properties (Right click on your project, choose Properties on the menu)
C/C++ Build -> Settings
Click on Binary Parsers tab and check PE Windows Parser
Keep clicking Move Up until it is at the top
This had been set to Elf, even though we were using a freshly downloaded Windows version of Eclipse.
sometime missed closing curly brace can be part of a problem. Make sure prototype your function at the beginning of the file. Then right click your project in the left side bar. click clean project. then click build project and finally run project
I encountered similar issues and their related problems a few days ago. Finally, I found out that, just because I had moved my project folder (workspace folder of Eclipse) to another place so Eclipse could not find what its need as usual.
Solution: I just set the workspace to my new place (Hey Eclipse, my workspace now is here) :
Menu "File" -> "Switch workspace" -> "Other..." -> click "Browse..." button and point to new place then click "Select Folder" button and click "Launch" button.
Nice day.

Eclipse CDT - new Makefile project with existing code - change global default build target

I have existing code with their own makefiles which I want to load into Eclipse CDT.
This is simple enough - Just create a new Makefile project with existing code.
However, I would like to manage what defaults are chosen for certain settings.
For instance the default build target is 'all'.
At the moment I have to manually change this for every single project.
Is there any way to specify project defaults which are used every time I create a new project?
In Eclipse 3.7.2:
Window -> Preferences -> C/C++ -> New CDT Project Wizard -> Makefile Project -> Behaviour [tab].