Output an .exe

Go To Last Post
7 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As will be obvious in a few seconds....I'm a total newbie...

Q: I'm trying to learn C from a book, is it possible to use Studio 4 to generate a .exe file, say for my "hello world" program. I was able to succusefully build the program, but since I am using an atmega 32 simulator and it soesn't have a "simulated LCD" yet, i guess I can't see "Hellow world" from the printf?

I was thinking that I would find the .exe file in the build folder, but i guess it doesn't need to make that file separatley in studio4.

So if I could either generate the .exe i could run it from the command line or if i could view printf output in the studio 4 I/O window...either would solve my problem.

I am sure I am overlooking many things, but I just cracked the book open!

If it is not practical to use studio 4 as an IDE for general C learning, then can someone suggest another IDE?

I'm using VISTA, I guess I can compile directly with Winavr and i just need an editor?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

An .exe file is only used for a pc. In a micro environmnet it is usual to have a .hex file which get programmed into the chip.

There is a LCD simulator floating around. I simply prefer using the real thing.
..and YES you are overlooking MANY things. :)

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If it's programs using printf() that you want to start with then you might be better off downloading Microsoft Visual studio Express and learning to program in that (probably C++ rather than C so you won't actually be using printf() )

The alternative is to get either (or both) of the totally free to download Hapsim and VMLab programs. The latter is a completely separate AVR simulator/IDE for which you'd need to persuade the WinAVR compiler to output COFF format files. Hapsim is a plugin for Studio that adds device smulation such as LCD

There is, of course, Atmel's own LCD simulator plugin for Studio but that does not simulate the HD44780 type of 2/4 line text LCD controller but the raw kind of segment driven LCD as found in something like the Butterfly/mega169 combination

Cliff

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I would suggest the basic Borland bcc32 that is free as a command line compiler.

I would also suggest that you do your practice on the PC with simple command line programs in C.

Starting with C++ or even attempting Windows programs is not the best way to learn C. At the end of the day you want to know how to do simple efficient programs --- Windows or GUIs are the complete opposite.

David.

p.s. I am happier with a command line because I am old. You may prefer an IDE to develop the code, but your code will use simple console type printf() and getchar().

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
I am happier with a command line because I am old. You may prefer an IDE to develop the code,
I am happier with an IDE because I am old. :lol:

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Now I guess I count as a "half way luddite". I use a Windows IDE to write C programs on the PC but it's actually the 1998 version of MS VC++ V6.0 and if I start it, select File-New... and on the projects tab select "Win32 console application" then in the next dialog I select "simple Hello, world program" then it generates this as a template:

// urrgle.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

int main(int argc, char* argv[])
{
	printf("Hello World!\n");
	return 0;
}

and when I build/run the .exe it opens a command prompt window, prints "Hello World!" to it followed by "press any key to continue"

Now maybe MS Visual Studio Express these days is "so advanced" that this is not possible any more? Perhaps they are trying to wean folks off "command line applications"?

But definitely MS VC++ V6.0, if you can lay your hands on a copy, is a quick and easy way to write SIMPLE programs to run on a PC

(well OK, that program did generate a 155K .exe file in fact! There used to be a time when I cared about such things but not any longer. The "release" version is a more palatable 28,672 bytes - but still quite a lot to printf("Hello World!") though)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

that's awesome guys

exactly the answers i needed!!!

i may be new, but i guess i know how to ask the right questions