Author Topic: Shell commands on Windows  (Read 6434 times)

Offline cmaxb

  • Multiple posting newcomer
  • *
  • Posts: 11
Shell commands on Windows
« on: October 24, 2006, 02:21:29 pm »
Hi, I am developing with mingw and codeblocks on winXP. I use qmake which uses a spec based on mingw and DOS, so Makefile contains things like:
Code
DEL_FILE      = del
DEL_DIR       = rmdir
MOVE          = move
This worked great for qt build from cmd.exe. However, when I build within codeblocks, I see messages like

Code
process_begin: CreateProcess((null), del parser_yacc.cpp parser_yacc.h, ...) failed.
process_begin: CreateProcess((null), move y.tab.h parser_yacc.h, ...) failed.

It seems I have to use the unix equivalents mv or rm to make it work.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Shell commands on Windows
« Reply #1 on: October 24, 2006, 03:47:55 pm »
Because C::B doesn't run in a command prompt, it can't run these shell builtin commands.
The solution is (besides using the unix equivalent commands) to change it like this:

Code
DEL_FILE      = cmd /c del
DEL_DIR       = cmd /c rmdir
MOVE          = cmd /c move

Or change the make commands in your project build options and prepend "cmd /c " for each one of them.
Be patient!
This bug will be fixed soon...

Offline cmaxb

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Shell commands on Windows
« Reply #2 on: October 25, 2006, 08:42:43 pm »
I found a switch 'MINGW_IN_SHELL' that I use in my enivronment. Qmake will use this to apply the unix equivalents. Also, for anyone interested. Here is how I set up Qt, in my environment:

I set up a tool that runs this batch file

cd C:\Dev\projectname
set QTDIR=C:\Dev\Qt\qt-win-opensource-src-4.2.0
set QMAKESPEC=C:\Dev\Qt\qt-win-opensource-src-4.2.0\mkspecs\win32-g++
set MINGW_IN_SHELL=1
C:\Dev\Qt\qt-win-opensource-src-4.2.0\bin\qmake -project "CONFIG += qt thread" "TARGET = projectname" "DESTDIR = bin/debug" "DEPENDPATH = inc src" "INCLUDEPATH = inc" "MOC_DIR = moc" "OBJECTS_DIR = obj" "UI_DIR = ui" "RESOURCES = app.qrc" "QMAKE_LEX = flex"
C:\Dev\Qt\qt-win-opensource-src-4.2.0\bin\qmake -makefile

I run this each time I add a class or header. Then I set external Makefile under Project.