ok, I tried that and it said that "autoexec.bat" is not an internalized command or something. I tried opening it manually but it just opens and closes quickly.
ok, I tried that and it said that "autoexec.bat" is not an internalized command or something. I tried opening it manually but it just opens and closes quickly.
Alternatively, try this very simple example using a batch file:
- Create a new directory on your desktop: 'New Folder'.
- Create a new text file in that directory. Call it main.cpp and add, for example
Code:#include <iostream> int main() { std::cout<<"hello from MinGW"<<std::endl; }- Copy a command prompt shortcut to the 'New Folder' and put the path to 'New Folder' into the 'start in' field of the command prompt properties (right-click on cmd prompt shortcut and select properties from menu).
- Create a text file in 'New Folder'. Call it 'build.bat' and add the following, replacing c:\mingw\bin with the actual path to your MinGW installation bin directory:
Code:set path=c:\mingw\bin;%path% g++ main.cpp -o test.exe- Launch cmd prompt by double-clicking its shortcut in 'New Folder'. Type 'build' then enter/return. This should create 'test.exe' in 'New Folder'.
- Type 'test' then enter/return to run test.exe
Compiling 'C'
Name text file in step 2. above as main.cFor step 4. the batch file should read:Code:#include <stdio.h> int main() { printf("hello from Mingw"); }Code:set path=c:\mingw\bin;%path% gcc main.c -o test.exe
Last edited by Ken Fitlike; 05-12-2004 at 06:58 PM.
CProgramming FAQ
Caution: this person may be a carrier of the misinformation virus.
I actuallty solved that (if its the same problem), last time I made a .bat file in XP, it had a .txt extention (.txt), I solved it with by messing with the file propertys in explorer, that COULD be the problem.Originally Posted by indigo0086
WorkStation(new, a month ago):
Sony Vaio i686 Desktop
2.60 GIGhz Intel Pentium 4(HT)
512Mb DDR RAM
800MHz Front Side Bus!
120 GIG IDE HardDrive
Matrox G400 Dual-Head
Linux kernel 2.6.3
Modified Slackware 9.1
GCC/GDB
Multi-mon
Simultaneous Multiple Processes
how do I create a command prompt shortcut?Originally Posted by Ken Fitlike
Just copy it from your start menu (it may be in 'accessories' or something in win2k/xp; I tend to move it into 'program files' so don't recall exactly where it's originally to be found).
Or, perhaps easier, right-click in the 'New Folder', select 'new shortcut' from the popup menu and pasteinto the 'type the location of the item' edit control, then click 'next' and finally 'finish'. That should create a 'cmd.exe' shortcut in win2k/winxp.Code:%SystemRoot%\system32\cmd.exe
CProgramming FAQ
Caution: this person may be a carrier of the misinformation virus.
ok i found out how to do it...not as easyas my visual studio.net though.
how do I get the program to run in a seperate window?
Last edited by indigo0086; 05-12-2004 at 07:23 PM.
>>ok i found out how to do it<<
Congratulations.
>>...not as easyas my visual studio.net though.<<
Which is probably why many MinGW users prefer an ide such as devcpp...
BTW, if you're feeling particularly masochistic you should be able to use msvc in an analogous fashion from the command line, too - just search through your .net installation directory for vcvars32.bat.
>>how do I get the program to run in a seperate window?<<
You read this faq and this faq, add the appropriate code and launch the program separately.
Last edited by Ken Fitlike; 05-12-2004 at 07:47 PM.
CProgramming FAQ
Caution: this person may be a carrier of the misinformation virus.
I think i'll stick to VS.net I tried devc++ but the iostream header wasn't there and it showed errors involving them.
IMO the DevC++ package is the best available for learning to code in windows. You'll find it much easier to use and will find its probably more current to the standards that M$.
iostream is deffinitely there.
Are you accessing the depricieted version, <iostream.h> or <iostream> ?
Open source isn't a matter of life or death......
.......its much more important than that!!
SuSE Linux - GCC 3.4.2
XP Pro - Visual Studio 2005 TS, MinGW 3.4.2