I wanna to copy a file to build dist directory in Qt Creator Custom Build Step:
But after I Build, the error thrown:
Could not start process "copy" C:\Users\W\Desktop\StockKLine-master\StockKLine-master\dataKLine.txt C:\Users\W\Desktop\StockKLine-master\build-StockKLine-Desktop_Qt_5_11_2_MinGW_32bit-Debug\dataKLine.txt /Y
However I can test the command in the cmd.exe without error
How Can I copy a file to dist folder in Qt Creator Custom Build Step?
copy is internal command for cmd. (See for example here)
You should use cmd to execute shell that will do the work and exit immediate (/c option), so it should looks something like:
Command: cmd
Arguments: /c copy %{sourceDir}\dataKLine.txt %{buildDir}\dataKLine.txt /Y
Other possibility will be to use xcopy:
Command: xcopy
Arguments: %{sourceDir}\dataKLine.txt %{buildDir}\dataKLine.txt /Y /I
Related
OS: Windows 10, x64
I have a simple demo of qt console project, which simply print hello world.
This project can be built and run correctly(with MSVC kit), but I want to separate the process.
First, I click "execute qmake" in the right-click menu on the project in Qt Creator, I got a make file in the release and debug directory
build-hello-Desktop_Qt_5_12_3_MSVC2017_64bit-Release\makefile
open cmd, cd to this directory, and then the story ends.
If I use nmake, I got error C1083, which tell me can not find stdio.h
If I use make on windows or mingw-make32, I still got an error missing separator.
I have 2 questions:
1.Can someone give a full instruction of how to make this makefile both with mingw-make32 and nmake?
2.The makefile generated by qmake looks very complex and illegible, not like those makefiles in tutorial. Is it just the same as a normal makefile, or it's special?
I search for a lot but still can get the clear solution so please help.
the Makefile looks like this:
#############################################################################
# Makefile for building: hello
# Generated by qmake (3.1) (Qt 5.12.3)
# Project: ..\name\hello.pro
# Template: app
# Command: C:\Qt\Qt5.12.3\5.12.3\msvc2017_64\bin\qmake.exe -o Makefile ..\name\hello.pro -spec win32-msvc "CONFIG+=qtquickcompiler"
#############################################################################
MAKEFILE = Makefile
EQ = =
first: release
install: release-install
uninstall: release-uninstall
QMAKE = C:\Qt\Qt5.12.3\5.12.3\msvc2017_64\bin\qmake.exe
DEL_FILE = del
CHK_DIR_EXISTS= if not exist
MKDIR = mkdir
COPY = copy /y
COPY_FILE = copy /y
COPY_DIR = xcopy /s /q /y /i
INSTALL_FILE = copy /y
INSTALL_PROGRAM = copy /y
INSTALL_DIR = xcopy /s /q /y /i
QINSTALL = C:\Qt\Qt5.12.3\5.12.3\msvc2017_64\bin\qmake.exe -install qinstall
QINSTALL_PROGRAM = C:\Qt\Qt5.12.3\5.12.3\msvc2017_64\bin\qmake.exe -install qinstall -exe
DEL_FILE = del
SYMLINK = $(QMAKE) -install ln -f -s
DEL_DIR = rmdir
MOVE = move
SUBTARGETS = \
release \
debug
full instruction of how to make this makefile with nmake
run visual studio command prompt and then run nmake inside it rather than run nmake in common cmd, because vs command prompt has already set the specific environment variables such as the path of includes and c++ standard library, whichout which cl.exe and link.exe can not work.
This is the reason exacly why can not find stdio.h.
I am trying to compile a simple Hello World from windchill shell using command javac com.A.B.Test.
But it is displaying could not find main class error.
I think your problem is Java and not Windchill related.
Let's say your Java source file is stored in the following location:
/src/com/A/B/Test.java
To compile that file in shell (Linux for example):
cd /src
javac com/A/B/Test.java
To run that file (if it contains a main method):
java -cp /src com.A.B.Test
Try using the below command from the windchill Shell.
Hope you are following the default file structure provided by the Vendor i'm providing the same below otherwise just edit the path mentioned in the below command.
javac -d codebase -cp %CLASSPATH%;%WT_HOME%\srclib\tool\Annotations.jar src*.java
First Go to Windchill Shell then navigate to the folder where java file is present. At that location type javac Test.java and press enter.
Put the code into WT_HOME/src/com/package, than run from WT_HOME:
ant -f bin/tools.xml class -Dclass.includes=com/..path-to-package/*
I am using a Qt .pro file using the SUBDIRS template (mainly following this answer).
Furthermore I am building my solution using qmake -recursive MyProject.pro and nmake Release.
Now I want to supply a separate batch file for cleaning up the release output and meta files (not the debug ones though).
The problem is that for the top-level Makefile, only clean and distclean is generated by qmake while for the subdirectories, there are also release-clean and debug-clean (also the folders contain an additional Makefile.Debug and Makefile.Release).
What I want to do is calling
nmake Makefile release-clean
from the batch script. However the top-level makefile does not contain this configuration.
Now I could call the equal line for every subproject manually but this is obviously my least favoured option.
Is there a way to either get qmake to generate a release-clean target for the top-level makefile or is there another way to simply clean release files?
PS: I'm using nmake, so yes I'm on Windows (XP) and using MSVC (2008)
The following batch script does the job :
REM set up environment
SET VISUALDIR=C:\PROGRA~1\MICROS~1.0
PUSHD %VISUALDIR%\VC
CALL vcvarsall.bat x86
POPD
REM clean solution
msbuild yoursolution.sln /p:Configuration=Release /t:clean
REM and you may want to add a build command :
msbuild yoursolution.sln /p:Configuration=Release
Ever tried nmake Makefile.Release clean, that should do the job.
I'm building a shell script that does a gradle build and then run my grunt build after it is done and I'm storing this shell script in a subdirectory but the the graddle wrapper is in the root directory of the file. My shell script looks like this
sh .././gradle ../build.gradle clean build
grunt build
So when I call the script from the root directory it looks like this
$ sh gradle fullbuild
It errors out saying that
Execution failed for task ':fullbuild'. > Process 'command 'sh'' finished with non-zero exit value 127
When I do the first command from the script in the sub directory it says
FAILURE: Could not determine which tasks to execute. * What went wrong: Task '../build.gradle' not found in root project 'tools'.
Can I call gradle from a subdirectory and use that directories build.gradle file?
With the -b flag you can indicate which build file to use. Try
sh ../gradle -b ../build.gradle clean build
You could also specify the -p flag instead which indicates which directory is the project dir.
This question appears to be answered in this tread
qmake: How do I copy .dll/.so's to the output directory?
but it does not work for me. I'm trying to do this within Qt Creator 2.0.1 with Qt SDK 4.7.0 on Windows 7
If I try:
QMAKE_POST_LINK=copy /Y \Projects\TestFile.txt \Projects\OSPF\TestFile.txt
on even a static file, the output I get is:
copy /Y \Projects\TestFile.txt \Projects\OSPF\TestFile.txt
process_begin: CreateProcess(NULL, copy /Y \Projects\TestFile.txt \Projects\OSPF\TestFile.txt, ...) failed.
make (e=2): The system cannot find the file specified.
If I try:
QMAKE_POST_LINK=cmd.exe /C copy /Y \Projects\TestFile.txt \Projects\OSPF\TestFile.txt
The output I get is:
cmd.exe /C copy /Y \Projects\TestFile.txt \Projects\OSPF\TestFile.txt
The system cannot find the file specified.
Does someone know the answer to this?
As the error message suggests the problem is in the path to the file you want to copy.
I created a simple .pro file and used the same command to copy a file - with the path changed accordingly - and it worked correctly.
QMAKE_POST_LINK=copy /Y .\hello.h .\debug\hello.h;
it's equivalent to
QMAKE_POST_LINK=copy /Y hello.h debug\hello.h;
With this command the file hello.h, in the same directory of the .pro file, is copied to the debug folder.
I got it!
Apprently the copy does not work if you start at the root of your drive. Go back and look at my example. I was starting at the root of my current drive. I also tried
QMAKE_POST_LINK=copy /Y $$PWD\MyFile $$PWD\anotherdir\MyFile
That did not work either.
Apprently you have to be relative to you directory???? I'm not sure what the real limitations are.