Student_I

Hi.
can I compile C++ code with VC++ or VC.Net to a BIN file
How
thanks.




Re: Visual C++ Language Compile C++ code To .Bin File

Simple Samples

Just rename the exe file to have a bin extension.




Re: Visual C++ Language Compile C++ code To .Bin File

Marius Bancila

The answer depends on what exactly is this .BIN file you are talking about. An EXE or DLL is a PE (portable executable) with a specific format. What is the format of this BIN you are talking about




Re: Visual C++ Language Compile C++ code To .Bin File

Student_I

thank you for answer.
I know that exe & dll files are Binary Files.
But I dont know any thing about *.bin file.
if you sreach about *.bin in Windows Directory , ( like C:\Windows ) you
can find this type.
I found the " ST20 ToolSet " software for Compiling C++ code to *.bin files.
now I have 2 promlems.

1- I cant found any Information about *.bin file. ( this is a binary file )
and what is difference within *.exe file structure and *.bin file Structure.
can I convert *.exe file to *.bin
2- VS or VS2005 can compile C++ code to *.bin files






Re: Visual C++ Language Compile C++ code To .Bin File

Marius Bancila

I know that exe & dll files are Binary Files.

Moreover, EVERYTHING IS BINARY. Remember that. Nothing that you have on your computer is anything else than binary. So, yes, EXE and DLL are binary, but they follow a specific format, called Portable Executable.

There are several questions you must clarify:

  • why do you want to compile the program as a file with the extension .bin (I didn't say binary, because EVERYTHING IS BINARY) you can only execute a EXE or DLL.
  • what is the binary format since you want to convert to bin, you should know in the first place what that bin is. otherwise, your request doesn't make any sense






Re: Visual C++ Language Compile C++ code To .Bin File

Simple Samples

You should have said in your original question that you don't know what a bin file is.

It is not a common format and therefore it is used in a variety of ways. The only way to know what format you need is to read the documentation of the specific software that you need the bin file for.






Re: Visual C++ Language Compile C++ code To .Bin File

Student_I

Hi again and I'm sorry I'm late!
I have a Microcontroller that must be program.
my programer needs a binary file. ( *.bin)
the *.bin file has no Header.( I checked it ) and this is difference within "BIN" files
and other type. cause this code run on processor. ( there is no Operating System!!! ) and
if my file has Header ( like exe,... ) it won't work. ( if I rename exe to bin. )
but I can't compile my C++ code to a binary file (*.bin)
what should I do




Re: Visual C++ Language Compile C++ code To .Bin File

Simple Samples

You must read the documentation of your Microcontroller! No one else can help you. If it does not provide instructions for using VC, then it is unlikely you can.




Re: Visual C++ Language Compile C++ code To .Bin File

Student_I

thank you for answer!
I think , MSDOS 5.0 had a function that converted exe to bin.
but I'm not sure. didn't it






Re: Visual C++ Language Compile C++ code To .Bin File

Brian Kramer

Yep.  Find out what sort of development tools target your embedded platform.  VC creates exe's and dll's (but you are free to change the extension), but you need a tool that writes executables in the actual format required by the actual operating system you're using.  Why are you choosing VC and asking us for help Shouldn't you be in investigating the "ST20 ToolSet" as you already mentioned.

Like Marius said, everything is binary on computers because all data is composed of 1's and 0's, making it a useless piece of information in achieving your goal.





Re: Visual C++ Language Compile C++ code To .Bin File

Simple Samples

I don't remember a bin format for DOS, but there might have been. If there was, then the format probably was not defined. Also, anything compiled by the C compiler would need either Windows or DOS; the C compiler never generated code that could execute stand-alone without an operating system.

I know that there is an embedded version of the VC compiler, and it might create the format you need. Look in the VC documentation for the embedded version to see if it can create a bin format. I suspect it won't do it for your microcontroller; I assume that the embedded version of VC creates executables for the embedded version of Windows.






Re: Visual C++ Language Compile C++ code To .Bin File

Student_I

thank you very much for your answer!
about "ST20 ToolSet" I said that it doesn't generate OPTIMUM binary code.
I will Search about *.bin & VC tools for my project.
thanks "Simple Samples","Marius Bancila ", "Brian Kramer"






Re: Visual C++ Language Compile C++ code To .Bin File

Marius Bancila

Student_I wrote:

thank you very much for your answer!
about "ST20 ToolSet" I said that it doesn't generate OPTIMUM binary code.
I will Search about *.bin & VC tools for my project.
thanks "Simple Samples","Marius Bancila ", "Brian Kramer"

What microcontroller is it From my knowledge (I work in a company that does a lot of embedded programming), there are very few C++ compilers that target embedded systems. Most embedded programming is done in embedded C. Basically, there are C compilers for most of available microcontrollers. So, question is, do you actually intend to use C++ or C






Re: Visual C++ Language Compile C++ code To .Bin File

Student_I

Hi again!
I use "AVR" microcontroller. (ATMEGA32)
I know and I have this compilers. ( like bascom,.... ).
this compilers are week and have many bugs!
I search about a powerful compiler for AVR microcontrollers.( C or C++ )
do you know a suitable Compiler for "AVR" microcontrollers ( C or C++ doesn't matter)
thank you again.




Re: Visual C++ Language Compile C++ code To .Bin File

Simple Samples

You should have included informatin such as this in your original question so we did not waste time trying to help you in ways that would not help.