Difference between revisions of "MINGW Development Package"
From Embedded Systems Learning Academy
(Created page with "This tutorial shows you how to compile a C/C++ program in windows using Eclipse and MINGW. '''MINGW''' stands for "Minimalist GNU for Windows". Remember that GNU is the linu...") |
(→Development Package) |
||
(One intermediate revision by the same user not shown) | |||
Line 3: | Line 3: | ||
== Development Package == | == Development Package == | ||
You can get the same development package as the one we promote for ARM processors. | You can get the same development package as the one we promote for ARM processors. | ||
− | + | * Get the Development Package and unzip in your C drive | |
− | + | *: '''[https://sourceforge.net/projects/armdevpkg/files/: SourceForge SJSU Development Package]''' | |
− | + | *: '''It is important to NOT unzip at your desktop''' | |
− | + | *: '''The unzipped path should not have spaces''' | |
− | |||
− | |||
<br/> | <br/> | ||
Line 15: | Line 13: | ||
| | | | ||
'''1.''' Open Eclipse. | '''1.''' Open Eclipse. | ||
− | <br/> Always open the MINGW batch file since it sets up environment variables for you. | + | <br/> Always open the MINGW batch file |
− | | [[File:mingw_open_eclipse.png|left|frame|Open MINGW bat file in your development package directory]] | + | <br/> since it sets up environment variables for you. |
+ | | [[File:mingw_open_eclipse.png|left|frame|100px|Open MINGW bat file in your development package directory]] | ||
|- | |- | ||
Line 27: | Line 26: | ||
* Then click '''Finish''' | * Then click '''Finish''' | ||
| [[File:mingw_new_project.png|left|frame|Create New Eclipse C++ Project]] | | [[File:mingw_new_project.png|left|frame|Create New Eclipse C++ Project]] | ||
− | <BR/> [[File:mingw_new_project_properties.png|left|frame|Create New Eclipse C++ Project]] | + | <BR/> [[File:mingw_new_project_properties.png|left|frame|100px|Create New Eclipse C++ Project]] |
|- | |- | ||
Line 56: | Line 55: | ||
* Now, go to '''Run''' --> '''Run''' | * Now, go to '''Run''' --> '''Run''' | ||
* The output will appear in the '''Console''' tab below. | * The output will appear in the '''Console''' tab below. | ||
− | | [[File:mingw_run_project.png|left|frame|Run your project]] | + | | [[File:mingw_run_project.png|left|frame|100px|Run your project]] |
Line 70: | Line 69: | ||
*: Double clicking on the code window sets a breakpoint. | *: Double clicking on the code window sets a breakpoint. | ||
*: You must press the red stop button to stop your program. | *: You must press the red stop button to stop your program. | ||
− | | [[File:mingw_debug_project.png|left|frame|Debug your project]] | + | | [[File:mingw_debug_project.png|left|frame|100px|Debug your project]] |
|} | |} |
Latest revision as of 20:07, 2 January 2014
This tutorial shows you how to compile a C/C++ program in windows using Eclipse and MINGW. MINGW stands for "Minimalist GNU for Windows". Remember that GNU is the linux-based compiler and hence if we want to use it for Windows, we have to have certain executable(s) to be running in Windows.
Development Package
You can get the same development package as the one we promote for ARM processors.
- Get the Development Package and unzip in your C drive
- SourceForge SJSU Development Package
- It is important to NOT unzip at your desktop
- The unzipped path should not have spaces
Open Eclipse and Create New Project
1. Open Eclipse.
|
|
2. Create a new C/C++ Project
|
|
3. Write your source code
|
#include <stdio.h>
int main(void)
{
/* Without this, printf() will not work */
setvbuf(stdout, 0, _IONBF, 0);
setvbuf(stdin, 0, _IONBF, 0);
/* Write rest of your code here */
printf("Hello World\n");
return 0;
} |
4. Run your program
|
|
4. Optional : Debug your program
|
Hints & Troubleshooting
- How do I run FreeRTOS simulator ?
- The easiest method is to use one of the existing projects. Open up Win32_Mingw_Tasks and write your source code there.
- If you want your own dedicated project, you can copy and paste that folder, and IMPORT this new project into eclipse
- Eclipse is unable to write to the executable
- It is possible that your program is already running, so terminate it using the Windows Task Manager