К вопросу о IDE для эхотага

Здравствуй, All!

Способ пpикpутить GCC AVR к MS Visual C++.

--──── Это начало Windows Clipboard ───---

Configuring Microsoft Visual C++ for use with an external compiler Sections Overview Creating a Visual C++ Makefile Project Setting up your build environment Other considerations when using an external compiler Written by Pascal Stang | Updated: Thu Feb 19, 2004

--------------------------------------------------------------------------------

  1. Overview Although there are plenty of excellent C/C++ code editors available, a large portion of programmers have had previous experience with Microsoft's Visual Studio and Visual C++ tools. The code editor built into Visual C++ offers a number of convenient features when coding, including project/file management, ClassView, autocomplete, function argument pop-ups, search/grep tools, etc. This begs the question: Can Visual C++ be configured to run external compilers such as GCC. And the answer is YES.

NOTE: This document will demonstrate how to set up Visual C++ to run an external makefile upon clicking the build button or pressing F7. This is sufficient to get AVR-GCC and other GCCs to work nicely with Visual Studio, and will hopefully serve as a starting point if you had something more exotic in mind.

There are two steps to getting Visual C++ to run an external makefile:

  1. Creating a Visual C++ Makefile Project
  2. Setting up the build environment in your installation of Visual C++

These instructions are valid for MS Visual C++ 6.0. Other versions may differ.

  1. Creating a Visual C++ Makefile Project In order to get Visual C++ to run an external makefile, you must first create a Visual C++ "project". A project saves your preferences and settings for editing and compiling/building a given application or program. As this implies, you will need to have (perhaps create) an independent project for each application or program that you write.

Do the following:

Open Visual C++ Select File => New Under the Projects tab, select Makefile Choose a project name and location for your project, and click OK (if your code files already exist, then you should place your project in the directory where you run make) For the DEBUG configuration, in the command line box, enter make. (if you are using something other than GCC/make then type in what you would ordinarily do to compile your program at the command prompt) In the output box, enter the name of the output executable (or leave it blank) For the Rebuild All Switch, enter clean all. (this argument depends on your makefile and may be different) Click Next, and enter the same or different arguments for the RELEASE configuration (you will be able to select between these two configurations later) Click Finish Your project is created! Now you may add existing or newly created *.c, *.h, and other files to your project as desired. To alter the configuration settings you chose when you created the project, go to Project => Settings.

When you click build or hit F7, VC++ will atempt to run make in the directory where your project files are stored. It is your responsibility to maintain your makefile. Any changes you make to your VC++ project (like adding or removing files from the FileView) will not alter the makefile in any way.

When attempting to compile/build:

-- If Visual C++ reports 'make' is not recognized as an internal or external command... then you are missing a PATH to your compiler tools or you have not installed the compiler correctly. See below.

-- If Visual C++ reports make: *** No targets specified and no makefile found. Stop. then the compiler is working and simply didn't find a makefile to build.

If you attempt to build and Visual C++ reports that it cannot find make or some other external compiler tools, you may need to customize your build environment. See below.

  1. Setting up your build environment Visual C++ keeps a seperate build enviroment when compiling/building from within. For this reason, you may need to add some directories to the internal PATH that VC++ uses in order to get your compiler to work.

For example, the current version of WinAVR (AVR-GCC compiler package) requires the following directories in the PATH (as always, fix these directories if you installed WinAVR somewhere other than the default location):

  1. c:\winavr\bin
  2. c:\winavr\utils\bin

To add these to VC++'s internal PATH, do the following:

Select Tools => Options Click the Directories tab Show directories for: Executable files Add the directories shown above to the list (in some cases, it might be necessary to make these entries the first on the list) Click OK Note: All settings under the Options dialog box are valid for all projects and are saved for the computer on which they were entered. Otherwise said, these Options settings are not saved in the project files. If you move to a different computer,or re-install Visual C++, you will need to re-enter any options.

  1. Other considerations when using an external compiler Finally, some other considerations when building from within Visual C++.

Compiler Error Output

-- Visual C++ can interpret compiler error output if it is formatted correctly. The format must be: full_path_and_filename(line number) : errortext c:\code\windows\bootterm\serialinterface.h(4) : fatal error C1083

If compiler error output is formatted this way, Visual C++ will jump to the file and location of the error upon double-clicking the error as listed in the output.

--------------------------------------------------------------------------------

Written by Pascal Stang | Updated: Thu Feb 19, 2004

--──── Это конец... Windows Clipboard ───---

Alex

Reply to
Alex Gavrikov
Loading thread data ...

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.