I'm making a DLL, written in C++ with Qt Creator (but no Qt stuff inside, pure homemade C++), and using a standard qmake + MinGW/g++ build process. My friend is doing the framework/main soft, and he's using Visual Studio Express 2015, and he's supposed to use my DLL inside of that. Because of that I want to use the same visual studio compiler for my project in Qt Creator.
So I noticed that Qt Creator had auto detected the Visual Studio C++ 14 compiler, which I believe is the one attached to Visual Studio Express 2015. When I create a kit with that compiler and set my project to compile with that kit, I get a suggested "Make" step which calls jom in the bin folder of my Qt Creator installation. I have no idea what this is and I get the following output (see below).
I don't know what to do from here. I also tried to create a compiler directly from the nmake executable in my Visual Studio installation, and then using it - but I get a very similar error about '-' not being recognized as an option. Any hints are greatly appreciated !
12:56:27: Starting: "C:\Qt\qtcreator-3.1.1\bin\jom.exe"
Usage: jom #commandfile
jom [options] [/f makefile] [macro definitions] [targets]
nmake compatible options:
/A build all targets
/D display build information
/E override environment variable macros
/F <filename> use the specified makefile
/G display included makefiles
/H show help
/I ignore all exit codes
/K keep going - build unrelated targets on error
/N dry run - just print commands
/NOLOGO do not print logo
/P print makefile info
/R ignore predefined rules and macros
/S silent mode
/U print content of inline files
/L same as /NOLOGO
/W print the working directory before and after other processing
/X <filename> write stderr to file.
/Y disable batch mode inference rules
jom only options:
/DUMPGRAPH show the generated dependency graph
/DUMPGRAPHDOT dump dependency graph in dot format
/J <n> use up to n processes in parallel
/KEEPTEMPFILES keep all temporary files
/VERSION print version and exit
Error: unknown command line option '-' in arguments: '/L-j4'
12:56:27: The process "C:\Qt\qtcreator-3.1.1\bin\jom.exe" exited with code 128.
Error while building/deploying project Ford_DAT_framework_DLL_as_plugin (kit: MVS Ford)
When executing step 'Make'
12:56:27: Elapsed time: 00:04.
So I used qmake -tpvc to generate a VCproj file which compiled almost immediately in Visual Studio Express 2015 which my friend uses. I guess that's a valid solution to my problem then !
Related
I'm trying to build the aasdk project on a Windows 10 computer. To do this, I am attempting to run the following commands in the root of the git repo directory:
mkdir buildDir
cd buildDir
cmake ..\
cmake --build . --config Release
The last command is obviously the one that's failing. I get the following output when I run that command:
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.19041.
-- Found libusb-1.0:
-- - Includes: C:/libusb-master/x64/Release
-- - Libraries: C:/libusb-master/x64/Release/lib/libusb-1.0.lib
-- Configuring done
-- Generating done
-- Build files have been written to: C:/aasdk-development/buildDir
Microsoft (R) Build Engine version 16.8.3+39993bd9d for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(200
,5): warning MSB8062: Custom build for item "C:\aasdk-development\buildDir\CMakeFiles\b2b8e2a3c1aae1e014a7c3c3f8aadde7\AVCha
nnelData.pb.h.rule" specifies invalid path "C:\aasdk-development\buildDir\aasdk_proto\protobuf::protoc" as an additional dep
endency. This may cause incremental build to work incorrectly. [C:\aasdk-development\buildDir\aasdk_proto\aasdk_proto.vcxpro
j]
...
Running cpp protocol buffer compiler on C:/aasdk-development/aasdk_proto/AVChannelData.proto
The filename, directory name, or volume label syntax is incorrect.
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(238
,5): error MSB8066: Custom build for 'C:\aasdk-development\buildDir\CMakeFiles\b2b8e2a3c1aae1e014a7c3c3f8aadde7\AVChannelDat
a.pb.h.rule;...' exited
with code 123. [C:\aasdk-development\buildDir\aasdk_proto\aasdk_proto.vcxproj]
Where ... is the same message repetead for each *.proto file inside aasdk_proto directory. From what I can tell, it seems it thinks some paths are invalid. What I can't tell, is which paths and in what way are they invalid.
After the first comment, I decided to check where it gets those paths. Below is the content of the CMakeLists.txt for protobuf, found in the aasdk_proto directory:
include(FindProtobuf)
find_package(Protobuf REQUIRED)
include_directories(${PROTOBUF_INCLUDE_DIR})
file(GLOB_RECURSE proto_files ${CMAKE_CURRENT_SOURCE_DIR}/*.proto)
protobuf_generate_cpp(proto_sources proto_headers ${proto_files})
add_library(aasdk_proto SHARED ${proto_headers} ${proto_sources})
target_link_libraries(aasdk_proto ${PROTOBUF_LIBRARIES})
Of interest is the 5th line which enumerates all the *.proto files in the relevant directory before calling protobuf_generate_cpp, the part which I believe to be causing the errors.
Adding message(STATUS ProtoFiles: ${proto_files}) after line 5 to print the paths yielded correct values, atleast to my eyes:
C:/aasdk-development/aasdk_proto/AbsoluteInputEventData.proto;C:/aasdk-development/aasdk_proto/AbsoluteInputEventData.proto;...
I replaced the forward slash with a backslash just for giggles, since that's how Windows likes them, but that didn't work.
I'm a bit late, but for anyone still having this problem, I ran into a similar issue while building CuraEngine, and found the cause. In my case, I had to set the path to protoc.exe with both variables PROTOC and Protobuf_PROTOC_EXECUTABLE. (I had only set PROTOC and CMake didn't throw any errors.)
I imagine the situation with aasdk must be similar. Some variable (probably PROTOBUF_PROTOC_EXECUTABLE?) that tells the location of protoc.exe must be missing.
I am using CMake 3.9.1, and I am already changing my project RUNTIME_OUTPUT_DIRECTORY to a different folder.
However, I want to change the output of hlsl files(cso).
The following works for CMAKE 3.9.1 visual studio
add_custom_command(TARGET ${projectName} POST_BUILD COMMAND cmd /c ${PROJECT_CONFIGURATION}/shadercopy.bat)
It will run the .bat right after visual studio builds the project and right before it executes!
Is there a way (like command line argument or some function in CMakeLists.txt) to print all command line arguments supplied to cmake invocation? Equivalent of bash "echo $#"
I need this to debug, why cmake invoked from qtcreator does not find my compiler (msvc12). After inspecting qtcreator sources, I see that it appends some environment by cmake arguments depending on selected kit. I got messages like
CMAKE_CXX_COMPILER not set
, when I select both "Nmake Desktop Qt MSVC2013 ..." or "Ninja Qt MSVC2013".
When I call cmake from command line, it finds compiler with no additional parameters:
-- Check for working CXX compiler using: Visual Studio 12 2013
-- Check for working CXX compiler using: Visual Studio 12 2013 -- works
My main problem was solved by installing ninja. I thought that the problem was not finding compiler by cmake invoked by qtcreator:
CMAKE_CXX_COMPILER not set
After installing ninja and restarting qtcreator, the problem was gone.
I had the same problem after upgrading Visual Studio 2017.
For some reason, when ADDING (?) CMAKE_CXX_COMPILER in the cmake configuration in Build & Run to the location of the Visual Studio compiler, it should work:
Key: CMAKE_CXX_COMPILER
Value: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe ==> replace version with the correct one
Don't forget to click "Apply Configuration Changes" below.
Very strange though, because after building, the cmake run becomes CMake Project was parsed successfully.and believe-it-or-not, the CMAKE_CXX_COMPILER is gone!
I've stumbled upon problems installing clang/LLVM on my Win 7 64-bit machine for setting up Emscripten in my Visual Studio 2010 Setup. I was following the official howto from Emscripten at https://github.com/kripken/emscripten/wiki/Using-Emscripten-on-Windows and stumbled into problems regarding the needed compilation of clang/LLVM.
svn co http://llvm.org/svn/llvm-project/llvm/tags/RELEASE_32/final llvm
cd llvm\tools
svn co http://llvm.org/svn/llvm-project/cfe/tags/RELEASE_32/final clang
cd ..\\..
mkdir build
cmake -G "Visual Studio 10" ..\llvm
msbuild LLVM.sln /p:Configuration=Release
The result is alot of errors similiar to this one:
CUSTOMBUILD : error : error reading '10.0\VC\bin\llvm\tools\clang\test\Index\
pch-opaque-value.cpp' [c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\b
in\build\tools\clang\test\check-clang.vcxproj]
CUSTOMBUILD : error : error reading '10.0\VC\bin\llvm\tools\clang\test\Index\
pch-with-errors.m' [c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\
build\tools\clang\test\check-clang.vcxproj]
Obviously, a path starting at
'10.0\VC...' is totally invalid.. its missing the 'C:\Program Files (x86)\Microsoft Visual Studio ' in front.. (I've checked there is a file like that in test\Index\ - it is!
My question is: how do I fix that ?
a) Can I setup an additional include path that is like 'C:\folder\MS Visual ' (including space) ?
What I have tried so far:
a) Doing it from Visual Studio Prompt and normal Prompt. Using default and custom location.
b) Running MSBUILD like
msbuild LLVM.sln /p:Configuration=Release /p:"VCBuildAdditionalOptions= C:\Program Files (x86)\Microsoft Visual Studio "
c) Trying to change PATH/Systemroot.. Destroyed my systemroot in the meantime for unknown reasons (It complaimed about a wrong path like "C:\Program " and erased it obviously).
I am seriously stuck and dont know any further than these steps. Setting up an include path does not seem to help - though I'm wondering if the CMAKE stuff had problems with space's or what is going on.
Since the authors of Emscripten and probably LLVM call their windows support "experimental", I'm not the only one having troubles trying to set up LLVM/clang for later use with Visual Studio 2010 (not 2012..). I'm sorry for the bad formatting, for some reason SO won't allow me neat formatting today.. I'm using a nightly browser build though.
If you just need a build of LLVM, you can generate NMake Makefiles and build with nmake instead of msbuild. It seems that there is a quoting issue somewhere (might be CMake, CmakeLists.txt, msbuild, who knows).
On second thought, this might be a problem with environment variables. How did you set up PATH? Try from a new "Visual Studio Developer Command Prompt".
I want to compile QT statically , I did the following steps:
1)configure -static -debug -opensource
2)nmake sub-src but in this step I have some errors like
D:\qt\bin\rcc.exe -name mimetypes D:\qt-everywhere-opensource-src-5.0.1\
qtbase\src\corelib\mimetypes\mimetypes.qrc -o .rcc\debug_static\qrc_mimetypes.cp
p
'D:\qt\bin\rcc.exe' is not recognized as an internal or external command,
operable program or batch file.
NMAKE : fatal error U1077: 'D:\qt\bin\rcc.exe' : return code '0x1'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 11.0
\VC\BIN\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
what should I do?
Before trying to compile Qt 5.x, you may need to install some libraries (depends of the modules you want to compile) :
ActivePerl (** needed, as it is used to configure qtsdk)
Microsoft Windows SDK 7.1
Microsoft DirectX SDK
Python
ICU
...
If you plan to use a library (like Assimp for example) which internally use the same libraries (like zlib), you may have to overwrite these libraries, located in the qtbase\src\3rdparty sub-directories, with their latest versions.
Edit the file configure.bat, located in the qtbase directory, and comment out the line 45 :
::if not exist %QTSRC%\.gitignore goto sconf
Edit the file qmake.conf, located in qtbase\mkspecs\win32-msvc2010 (if you're using Visual Studio 2010) or in qtbase\mkspecs\win32-msvc2012 (if you're using Visual Studio 2012) :
line 9 : CONFIG += incremental flat precompile_header autogen_precompile_source debug_and_release debug_and_release_target
line 23 : QMAKE_CFLAGS_RELEASE = -O2 -MT
line 24 : QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -MT -Zi
line 25 : QMAKE_CFLAGS_DEBUG = -Zi -MTd
Start the Visual Studio command prompt : Start > Programs > Microsoft Visual Studio 20XX > Visual Studio Tools.
Make sure that the path to Perl.exe is in the PATH environment variable : PATH=%PATH%;C:\Perl\bin (or PATH=%PATH%;C:\Perl64\bin if compiling for x64).
Go in the qtbase directory : CD \Qt\5.0.1\qtbase.
Configure Qt for compiling statically debug and release versions :
configure -developer-build -opensource -confirm-license -platform win32-msvc2010 -mp -nomake examples -nomake tests -static (if you're using Visual Studio 2010)
configure -developer-build -opensource -confirm-license -platform win32-msvc2012 -mp -nomake examples -nomake tests -static (if you're using Visual Studio 2012)
Examples and tests can be compiled later, if you need them.
If you plan to use OpenGL, add -opengl desktop to the command line, otherwise Qt will use by default OpenGL/ES which is targeted for mobile devices.
If your CPU is not multicore capable, remove the -mp option.
Go back in the parent directory : CD ...
Configure again Qt : configure -developer-build -opensource -confirm-license -platform win32-msvc20XX-opengl desktop -mp -nomake examples -nomake tests -static
(I'm not sure this step is needed, but as it takes just a few seconds...).
Compile : nmake.
Another method for compiling is to use jom and specify the number of CPU cores to use : C:\Qt\jom\jom.exe -j #NUMBER_OF_CORES#.
You will find the compiled static libraries in the qtbase\lib folder and the files to include in the sub-directories of qtbase\include.
To use them, you will have to use static run-time libraries (/MT or /MTd) in your Visual C++ project.