![]() |
.. (לתיקייה המכילה) | |
Some problems can arise if Eclipse is installed in a directory which has Hebrew directory names in the path to it. For example : C:\מתמ\Eclipse. The problem can also arise if a workspace is opened in such a directory, for example C:\מתמ\Ex1 . | |
If everything works for you – do not change anything. If you have problems with mingw libraries, gcc or gdb not found, do the following: 1. Go to Control Panel, "Clock, Language, and Region", "Regional and Language Options". Go to the last tab "Administrative and change "Language for non-Unicode programs" into "Hebrew (Israel)". (A restart will be required) If it does not help, do the following: 2. Copy Eclipse directory to some directory without Hebrew names in its path, for example C:\Eclipse. Create a new workspace, for example C:\workspace and import the previous project into the new workspace by using File->Import ->General->Existing Projects into Workspace. Alternatively, you can simply open a new project , add and copy the files one by one to this new project from the old project. |
Q. I try debug and receive the error : 'gdb' is not found. | |
A. You probably have the Eclipse installed in a directory which has Hebrew directory names in the path to it. For example : C:\מתמ\Eclipse. See the previous question how to fix the problem. |
Choosing the right Tool Chain | |
Please pay attention to selecting MinGW GCC toolchain when you create an Eclipse project, see http://webcourse.cs.technion.ac.il/234122/Spring2009/ho/WCFiles/eclipse_project_toolchain.JPG . If you forget to do it, you can change the toolchain to MinGW GCC in Project -> Properties -> C/C++ Build -> Tool Chain Editor. See http://webcourse.cs.technion.ac.il/234122/Spring2009/ho/WCFiles/eclipse_tool_chain.JPG |
Q. How do I use the files you supplied in my Eclipse CDT project? | |
A. First you will need to copy the files, including the object file into your Eclipse project. You can do that by simply dragging them into the project folder in the "Project Explorer" tree in Eclipse. See http://webcourse.cs.technion.ac.il/234122/Spring2009/ho/WCFiles/eclipse_add_object_project_explorer.JPG To link the object file (Which contains the implementation) you will need to add the object file for the linker options. To do that: 1. Open Project, Properties. 2. In that dialog select "C++ Build, Settings". 3. Under the Tool Settings tab choose "Linker" or "MinGW C Linker" or equivalent and under that select "Miscellaneous". 4. Under the "Other Objects" press the "Add..." button (the green cross) and type the name of the supplied object. Do not use Workspace or File system options, just type the name of the object. See "before and after" screenshots: before: http://webcourse.cs.technion.ac.il/234122/Spring2009/ho/WCFiles/eclipse_add_object.JPG after: http://webcourse.cs.technion.ac.il/234122/Spring2009/ho/WCFiles/eclipse_added_object.JPG |
Q. When I try to run my project in Eclipse I get a "Launch failed. Binary not found." error | |
A. That means there is no compiled binary of the project to run. Follow the following steps: - Build your project by choosing "Project | Build all" (Or press Ctrl+B), make sure the build has succeeded - Under your project in the explorer (tree view) you should see a "Binary" label containing all binaries in the project. If you don't see that make sure no compilation errors occurred (Look at the console window, or "problems" window), make sure your project name does not contain spaces. - Once your project is go to "Run | Run configurations...", double click on "Local C/C++ Application" to create a new suitable configuration. If the project name or application name are missing use "Browse" to select the right project and "Search project" to locate the newly created binary file. - Select "Run" |
Q. I have the following error:
| |
A. You probably added mtm_ex1.o via Workspace or File system. You should just type "mtm_ex1.o" , as explained in the previous question. |
Q. I have the following error : | |
A. You probably have the previous version of your program still running. You should terminate it - go to Debug view and push the red button (Red square - "Terminate"). |
Q. Sometimes, after I start Eclipse, it shows errors which were already fixed previously. What is the matter ? | |
A. Just run Project-> Clean and build, and the errors will disappear (if they indeed were fixed). |
Q. I have the following error:
| |
A. You probably use a wrong Tool Chain. See "Choosing the right Tool Chain item" |
Q. I have the following error:
| |
A. You probably use a wrong Tool Chain and a wrong Builder. See "Choosing the right Tool Chain item" |
Q. I have the following error:
| |
A. You probably use a wrong Builder. See "Choosing the right Tool Chain item" |
Q. Eclipse does not print output/error messages to the console ! | |
A. Just insert the following two lines in the beginning of main(): setvbuf(stdout, NULL, _IONBF, 0); setvbuf(stderr, NULL, _IONBF, 0); |
Q. Wait! What do these two lines from the previous answer mean? | |
A. O.K. Here goes: Input / Output operations (Like writing to a file or the screen) are in fact very slow. However in a lot of cases writing a reasonably sized string at once can take the same time as writing one character only. Because of that I/O operations are made using a buffer. For example every time your program prints (by calling printf etc...) the data is first copied into a buffer that is part of the appropriate FILE* and only once in a while the data is actually passed on to the output device. Unfortunately, this it not the behavior you would want with a terminal window. Because of that output in terminals is usually flushed after each line or every character. Unfortunately (again), under Windows, Eclipse CDT cannot automatically make its console behave like a terminal which may cause re-ordering of I/O operations. Luckily, you can simply change the buffer size of a FILE* in C, or remove it completely. To do so you use the function setvbuf. The two lines mentioned before will simply disable any buffering for stdout and stderr and solve the problem. If you wish to learn more about setvbuf you can do so here. |
How can I find/create useful shortcuts in Eclipse? | |
Press ctrl+shift+L to see the shortcuts. If you wish to change any of them, press ctrl+shift+L twice (that is, once more after you enter the shortcuts window) and you will find the keys prepferences window pop up. |
Q. How can I pass arguments to a program in Eclipse ? | |
A. Go to Run -> Run Configurations -> Arguments , and write the arguments in the Program Arguments box. | |
קישור: Link: Ссылка: وصلة: | http://webcourse.cs.technion.ac.il/234122/Winter2009-2010/ho/WCFiles/RunConfigurations.JPG |
Q. I have a problem with debugging in Eclipse. | |
A. There is a problem with debugging in Eclipse in a console mode (handling input/output via the console). You should pass the input/output files by using –i and –o flags for debugging. See the question above how to pass arguments to a program in Eclipse. |
Q: How do I add a library (.a) file to an Eclipse project? | |
A: Go to Settings->MinGW C Linker->libraries. There, add mtm as under "libraries" (press the green plus sign) and add the correct directory path under "Library search path" (press the second green plus sign and choose "workspace" and then the project folder. | |
קישור: Link: Ссылка: وصلة: | http://webcourse.cs.technion.ac.il/234122/Spring2009/ho/WCFiles/eclipse_link_libmtm_library.JPG |
Q. I am using Windows Vista and Eclipse there is unable to find includes, even stdio.h. What should I do ? | |
A. There is a problem in Eclipse in Vista when Eclipse is installed in a directory that has whitespaces in a path, for example "My Documents" or "Program Files". You should just copy the Eclipse to a directory without whitespaces, for example "C:\Eclipse". |
Q. When I link the project in Eclipse I get this error message :"..\..\: No such file: No such file or directory" | |
A. Try to do the following: 1. drag mtm_ex1.o to your project 2. write in the linker options mtm_ex1.o as is, not using Workspace or File system options |
Q. Where should I put the tests file ,so Eclipse could read them by providing "-i test.in -o test.out" as arguments ? | |
A. 1. You can drag the files into the Eclipse project 2. You can put the tests in any directory and just specify a full path to them (inside quotes, for example: -i "C:\Ex1\tests\test1.in" -o "C:\Ex1\tests\test1.out" ) |
Q. I have the following strange behavior in Eclipse: | |
A. You can fix this behavior in the following way: Go to Project -> Properties -> C/C++ Build -> Behavior tab, uncheck "Stop on first build error" |
Q. My Eclipse is unable to find standard headers like stdio.h . What can I do ? | |
A. You should do the following: 1. Go to Properties -> C/C++ general -> Paths and Symbols -> Includes -> GNU C, Add, and add the following directories C:/eclipse/mingw/include and C:/eclipse/mingw/lib/gcc/mingw32/3.4.5/include . You should use your eclipse directory instead of C:/eclipse. 2. Go to Properties -> C/C++ build -> Settings -> MinGW Linker -> Miscellaneous -> Linker flags and write there : -B C:/eclipse/mingw/lib -B C:/eclipse/mingw/lib/gcc/mingw32/3.4.5 You should use your eclipse directory instead of C:/eclipse. |
The Eclipse debugger is stuck | |
Please provide more details about the behavior. See the following two items. |
-- Debugger stuck - case 1 | |
Symptom: The debugger stops in a weird function of the operating-system. The code window rightfully says that it can't show code for it. The Debug window shows in the call stack (chain of calls) unknown names, Directions: In all cases it was by illegal memory access. Run the program in valgrind ! Or, check if you accidentally store a pointer to a local variable (which becomes illegal when its function ends) in a long-term data structure. |
-- Debugger stuck - case 2 | |
Symptom: The Console prints " *stopped because of ... ". The "Play button" doesn't help. In the Task Manager (of Windows) you see the gdb process. Directions: not too much :( First, kill the gdb process. Try to run smaller tests - this bug seems to occur when there is too much output in the Console. (regardless of the actual commands that you run. You can check this by deleting some commands from your test, and seeing that now it "got some more room" to commands that previously crashed). Or - run the huge tests in t2. (You don't want to debug a huge test... If you have a bug that needs debugging, write a small test that reproduces it). |
Q. The Console view says "mi_cmd_var_create: unable to create variable object" | |
A. Maybe the "Expressions" view tries to show variables from old projects, which aren't recognized in the current project. |