I have project that was created in another IDE that is build for a specific microcontroler. In the code faris used quite often and it is comprehended by the IDE and compiler.
I would like to use eclipse to edit the code, because it is more convinient to use. But it generates a lot of warnings and errors in the editor because he can not resolve the far.
I could create a macro #define far, but I would have to remove it when I want to compile the code. I don't compile with eclipse, because getting the compiler to work there is cumbersome and might introduce problems.
So is there a possibility that eclipse itself can handle the far for its syntax check?
Another approach that involves modifying your code rather than the project settings would be:
#ifdef __CDT_PARSER__
#define far
#endif
__CDT_PARSER__ is a macro that is automatically defined by CDT's parser when it processes your code, but not by any compiler.
After I searched a bit more I found an answer here:
https://www.eclipse.org/forums/index.php/t/72375/
Go to the menu:
Project -> Properties -> C/C++ General -> Path and Symbols ->
Symbols
and add a Symbol called far with the value /* */.
I just left the value empty and it worked.
Related
I am working on a scala project in IntelliJ and want to clean up my code.
For this, I am looking for a way in which I can get a list of unused methods within my project.
This link didn't answer my question. It is for Java and not for Scala.
Finding unused methods in IntelliJ (excluding tests)
Analyze -> Inspect Code for Scala in IntelliJ has an option to select unused symbol but I am unable to drill it down to only check methods.
Go to Analyze -> Inspect code
Under Inspection Profile click on "..." and make sure "Unused declaration" is checked. Chose Whole project option and then OK.
Hope this is not a duplicate... It should not since I tried the usual provided fixes.
I'm facing problems with the automated generation of comments for Classes and Methods using Elipse CDT (Juno/3.8, Linux) configured with Doxygen as default Documentation Tool.
I still get empty comments area for methods parameters while typing /** + ENTER :
/**
*
*/
Here is what I already tried without success :
Setting : Windows > Preferences > C/C++ > Editor > Documentation Tool Comments > Doxygen
Setting : Project > Preferences > Enable Project Specific Settings > Doxygen
Both lead to the same result.
Note : not sure about what happened with Eclipse configuration (it used to work fine before). Is that possible that I erased the Doxygen presets (maybe by pressing Windows > Preferences > C/C++ > Code Style > Code Templates > Restore Defaults). In that case how to get it back to Doxygen style ?
EDIT: I've got some new on the subject...
Basically, it was a global change in my project (which actually is a shared library). For some cross-platform portability reasons, I had to add a MACRO before all my classes, like follows :
class LIB_CLASS LabOneOfMyClasses {
public:
...
}
Unfortunately, doing this seems to break CDT's ability to generate smart functions headers (#param, #return, ...). So removing temporarily the MACRO, allows to get ride of this disagreeable behavior. It is annoying and is something I should report to CDT's staff...
Note : In the end, it is handled properly in Doxygen, anyway.
If someone has a brilliant idea, something I missed, about that ?
You can create a compiler abstraction header to solve this issue. Define a custom symbol in eclipse for your build configuration. Go to Project > Properties > C/C++ General > Paths and Symbols > Symbols > GNU C/C++ in eclipse and define a new unique symbol like #__ECLIPSE_CDT__.
Than in the compiler abstraction header you can write the followings:
#ifdef __ECLIPSE_CDT__
# define LIB_CLASS
#else
# define LIB_CLASS <required normal content>
#endif
And if you consistently include this compiler abstraction header into your files than eclipse will expand LIB_CLASS to nothing while your compiler will find and use the proper definition.
I'm writing some C++ code with eclipe.
I have a strange behavior with vector objects.
When I use the method resize for example, Eclipse returns the following error:
#include "vector"
...
vector<int> a;
a.resize(5);
Error: Invalid arguments candidates are: void resize(?, int).
However the code compiles from command line.
How can I fix this fastidious behavior of eclipse?
After quite a while searching and tinkering with settings, I think I have found an answer. To get the indexer parsing the code correctly I had to:
Right click the project -> Properties
Go to C/C++ General -> Preprocessor Include Paths, Macros etc.
Click the providers tab
Check the CDT GCC Build-in Compiler Settings option
Apply
Rebuild index
In Eclipse CDT, I would like to create syntax highlighting and a error parser for a custom filetype, lets say *.xy.
Those files do not contain C-Code, so i cannot use any existing parsers.
What kind of plugins would I have to create?
For the error parser, I think I have to use Codan? (have not tried it yet)
https://www.ibm.com/developerworks/java/library/j-codan/
The CDT is the wrong start for your journey, if your language is not related to the CDT supported languages and workflows. Implement an xtext based language editor instead.
Maybe this is a simple solution for you:
colorEditor plugin
You can simply add a new language by unpacking the jar archive, then adding a xyz.xml file for your .xyz files.
Pakc together again, and copy into your Eclipse "plugins" dir.
You need to introduce a new "language" - this is the extension point: http://help.eclipse.org/helios/topic/org.eclipse.cdt.doc.isv/reference/extension-points/org_eclipse_cdt_core_language.html
Codan is not an "error parser" it is a static analysis framework. Error parser processes output of the command-line tools you use to build the application (e.g. compiler, linker) to identify errors that happened during the build and filling their attributes, e.g. source file name and line number.
Codan analyzes the source code in the editor to identify errors. E.g. it checks if the variable used in the expression was declared beforehand. Note that same check can be performed by a compile at a build time and then captured by error parser and shown in the editor/problems view - the goal of Codan is to detect problems sooner, before the build is even ran. Codan can also perform some checks that compiler doesn't.
I'm using GWT in my stuff, and I would like to make it,
international, so I use GWT constants method.
I have a java file with defaults, and I now need to make properties files.
In a remember, there is a special thing to do (or done automagically) to generate
a kind of template where all constants are generated with empty labels for other langages.
Did I dream this ?
(using eclipse indigo to develop webapp with gwt but not gae)
[edit:]
this was not a dream, it's i18ncreator:
http://code.google.com/intl/fr-FR/webtoolkit/doc/latest/RefCommandLineTools.html#i18nCreator
but I can't make it working on windows :-(
[edit again ]
due to this issue : http://code.google.com/p/google-web-toolkit/issues/detail?id=5113
recommended solution is use i18ncreator in gwt 1.7 (!)
you should see the page on locales in GWT
I had the same issue. I was looking all over the place for the answer but could not find an answer; either in the docs or on stackoverflow.
So I asked in the GWT gitter channel and was told to use the compiler argument
-extra <destination-folder-name>
to generate the .properties files from the Interface files.
Steps in eclipse:
Select project you want to compile
[right click] -> Google -> GWT Compile
In the window that opens, open the Advanded options.
Add the following additional compiler argument -extra <destination-folder-name>
Compile
This should generate the *.properties files in the /destination-folder-name.
NOTE: This only generates the .properties files. It does not actually compile the application with all the locales for deploy.
Move the MyInterfaceExtension_*.properties to be right beside the MyInterfaceExtension.java file.
Make copies for each locale i.e. MyInterfaceExtension_fr_CA.properties, MyInterfaceExtension_fr_FR.properties, etc..
Translate them
Then run the compilation process again with out the -extra <destination-folder-name> option. Because it is not needed anymore.
This will compile with all the locales you enabled. You can now deploy the app the usual way.
Quick Tips:
When compiling for the first time in order to generate the .properties file, I commented out the locales in the module definition file so that the compiler will not sit there and compile again and again for every browser and every locale
i.e. supported_browser_count x enabled_locale_count = 5 browsers x 3 locales = 15 compilation Permutations, which is going to increase your compilation time.
Because, all I needed was that one *_en.properties file.
For the second compilation, after you copied and translated the properties files for each locale, you have to enable all the locales you want to support and compile.
Credits:
github #niloc132 : Colin Alworth
github #ibaca : Ignacio Baca Moreno-Torres
For helping me with this.
For my project, I used the i18n-Creator
http://code.google.com/webtoolkit/doc/latest/DevGuideI18n.html#DevGuidePropertiesFiles
It kind of does the opposite of what you are asking for. With the i18n-creator, you create the properties files for the various locales and run the script that is generated with the i18n-creator, and it will generate the constants interface.
I haven't heard yet of this feature in Eclipse but IntelliJ IDEA has this feature, you just create the Constants Interface class and the properties file. If you add a method in the class file it will warn you to add the property or the other way around. HTH.