I need to display a property browser under a MFC app.
I try to combine and compile the solution for the two
http://qt.nokia.com/products/appdev/add-on-products/catalog/4/Windows/qtwinmigrate/
http://qt.nokia.com/products/appdev/add-on-products/catalog/4/Widgets/qtpropertybrowser/
I am using VC2009, QT 2009.04 with Visual Studio Add-On 1.1.1
Take note, under my machine, there are no problem for me to compile them successfully separately.
I copy, and add all exsiting CPP and HEADER files found in
qtpropertybrowser-2.5-opensource\src
into
qtwinmigrate-2.8-opensource\examples\qtdll
Here is how my new project looks like in the screen shoot (qtwinmigrate - windows at right most)
(source: googlepages.com)
The qtpropertybrowser, is the project which I am able to compile with no problem :
1>------ Rebuild All started: Project: simple, Configuration: Release Win32 ------
1>Deleting intermediate and output files for project 'simple', configuration 'Release|Win32'
1>Moc'ing qtpropertybrowserutils_p.h...
1>RCC ..\..\src\qtpropertybrowser.qrc
1>MOC ..\..\src\qtvariantproperty.h
1>MOC ..\..\src\qttreepropertybrowser.h
1>MOC ..\..\src\qtpropertymanager.h
1>MOC ..\..\src\qtpropertybrowser.h
1>MOC ..\..\src\qtgroupboxpropertybrowser.h
1>MOC ..\..\src\qteditorfactory.h
1>MOC ..\..\src\qtbuttonpropertybrowser.h
1>Compiling...
.
.
.
1>Compiling...
1>moc_qtpropertybrowserutils_p.cpp
1>Linking...
1>Embedding manifest...
However, when come to build modified version of qtwinmigrate (original version of qtwinmigrate was able to compiled with no problem)
1>------ Rebuild All started: Project: qtdialog, Configuration: Release Win32 ------
1>Deleting intermediate and output files for project 'qtdialog', configuration 'Release|Win32'
1>Moc'ing qtpropertybrowserutils_p.h...
1>Moc'ing qteditorfactory.h...
1>Moc'ing qtvariantproperty.h...
1>Moc'ing qttreepropertybrowser.h...
1>Moc'ing qtpropertymanager.h...
1>Moc'ing qtpropertybrowser.h...
1>Moc'ing qtgroupboxpropertybrowser.h...
1>Moc'ing qtbuttonpropertybrowser.h...
1>Moc'ing qwinwidget.h...
1>Moc'ing qwinhost.h...
1>Compiling...
.
.
.
1>Compiling...
1>moc_qtpropertybrowserutils_p.cpp
1>moc_qteditorfactory.cpp
1>.\Release\moc_qteditorfactory.cpp(74) : error C2027: use of undefined type 'QtSpinBoxFactoryPrivate'
1> c:\documents and settings\yan-cheng.cheok\my documents\downloads\qtwinmigrate-2.8-opensource\qtwinmigrate-2.8-opensource\examples\qtdll\release\../../../lib/qtpropertybrowser-2.5-opensource/src/qteditorfactory.h(97) : see declaration of 'QtSpinBoxFactoryPrivate'
1>.\Release\moc_qteditorfactory.cpp(74) : error C2227: left of '->slotPropertyChanged' must point to class/struct/union/generic type
My questions is
Why qtpropertybrowser just perform "Moc'ing" in 1 file, but qtwinmigrate perform "Moc'ing" in so many files?
Why qtpropertybrowser just compile "moc_qtpropertybrowserutils_p.cpp", but qtwinmigrate try to compile so many "moc_....cpp"?
It looks like your two vcproj files don't have the same "moc" properties... It can leads to strange behaviors with the classes that uses the moc...
How did you generate the vcproj file in the second project ?
Did you build both vcproj from the PRO files or just by adding the existing cpp/h files directly in VS ?
If you build the first example from the example's PRO file then just copied the cpp files in another vcproj by adding them through VS, then something probably went wrong with moc properties...
In your vcproj files, try and look for "moc_" and look for differences between the two files... I think it will give you a further step in the process of finding the source of your problem...
I hope it helps a bit...
1) Under Visual Studio 2008, go to Qt -> Open Qt Project File (.pro), open
qtpropertybrowser.pro
2) Go to "simple" Properties, under Build Events -> Pre-Build Event, enter the
following commands :
moc ..\..\src\qttreepropertybrowser.cpp > ..\..\src\qttreepropertybrowser.moc
moc ..\..\src\qtpropertymanager.cpp > ..\..\src\qtpropertymanager.moc
moc ..\..\src\qteditorfactory.cpp > ..\..\src\qteditorfactory.moc
3) Under C/C++ -> Additional Include Directories, enter the following path :
..\..\lib\qtwinmigrate\src
4) Under General -> Configuration Type, change to Dynamic Library (.dll)
5) Under Linker -> General -> Output File, change to \qtdialog.dll
6) Exclude original main.cpp from simple project. Add in main.cpp from
..\..\lib\qtwinmigrate\examples\qtdll
7) Add in all 3 cpp files and 3 header files from
..\..\lib\qtwinmigrate\src
8) Build all. qtdialog.dll will be generated.
9) Open up \lib\qtwinmigrate\examples\mfc\step1. Build all.
10) Move qtdialog.dll same directory as step1 generated exe. Run the application.
Related
I have a project in my solution which gets built (consequently all the dependent projects as well) on every run due to the following file missing. I changed the build output verbosity to Diagnostics and got the following line at the top of the build of the said project:
Build started...
1>------ Up-To-Date check: Project: project_name.vcxproj, Configuration: Release x64 ------
1>Project is not up-to-date: build output 'c:\path\appdata\local\temp\lnk{24e28c62-71a7-43ad-81e2-9b34157645b4}.tmp' is missing
1>------ Build started: Project: project_name, Configuration: Release x64 ------
This number (24e28c62-71a7-43ad-81e2-9b34157645b4) changes on every build.
The solutions that I have tried which didn't work:
Deleted the .suo file.
Deleted temp folder, caches and settings.
Reinstalled the VS 2022.
The rebuild happens when I click the build solution regardless of any changes or lack there of in the code.
Edit:
The linker /VERBOSE output on building the said project:
Build started...
1>------ Build started: Project: project_name, Configuration: Release x64 ------
1>Invoking cvtres.exe:
1> /machine:amd64
1> /verbose
1> /out:"C:\Users\path\AppData\Local\Temp\lnk{01385313-5798-4F09-8223-983424FE6954}.tmp"
1> /readonly
1> "C:\Dev\dev\ws2\build\Release_x64\i\project_name\name-of-dll.res"
1>Microsoft (R) Windows Resource To Object Converter Version 14.30.30711.1
1>Copyright (C) Microsoft Corporation. All rights reserved.
1>
1>adding resource. type:VERSION, name:1, language:0x0407, flags:0x30, size:576
You seem to be building a DLL. So this doesn't apply to you.
But for others that get this when building a static library, hang on...
Here's a possible cause for rebuilds:
Your static library project might contain a resource (*.RC) file.
It's quite odd for a static library to contain a RC file because it could clash with other projects in your solution that consume the static library.
Deleting the .rc and resource.h files can solve the issue (at least it did for me).
The other (top) reason is that your project file points to header files that you have deleted. Since the compiler is not invoked for header files, you won't see errors when building so this is easy to miss!
My specific case was the one described by E. van Putten's answer, where Lib screws up when given a .res file as input. More precisely, it ends up writing the path of a temporary file into the .tlog file that is used for its subsequent up-to-date checks (at which point said file is long gone).
Until this is fixed, I've written a crude MSBuild target that is sequenced right after Lib and filters out nonexistent paths from the generated .tlog file.
<!--
This removes the broken temporary file paths that Lib.exe
puts in tlog files when it processes a .rc file.
See https://stackoverflow.com/q/74536502/3233393.
-->
<Target
Name="BugfixTempFilesInLibTlogs"
AfterTargets="Lib"
Condition="Exists('$(TLogLocation)Lib-link-cvtres.write.1.tlog')"
>
<ReadLinesFromFile
File="$(TLogLocation)Lib-link-cvtres.write.1.tlog"
>
<Output TaskParameter="Lines" ItemName="_LibWriteTlogLines" />
</ReadLinesFromFile>
<!--
Insane item juggling because MSBuild blows up as soon as one mentions `%(FullPath)`
for something that is not actually a path, such as the first line
from the .tlog file (which is of the form `^<file>|</file>|...`)
-->
<ItemGroup>
<_LibWriteTlogLinesToRemove Include="#(_LibWriteTlogLines)" />
<_LibWriteTlogLinesToRemove
Remove="#(_LibWriteTlogLinesToRemove)"
Condition="$([System.String]::new('%(Identity)').StartsWith('^'))"
/>
<_LibWriteTlogLinesToRemove Remove="#(_LibWriteTlogLinesToRemove->Exists())" />
<_LibWriteTlogLines Remove="#(_LibWriteTlogLinesToRemove)" />
</ItemGroup>
<WriteLinesToFile
Condition="'#(_LibWriteTlogLinesToRemove)' != ''"
File="$(TLogLocation)Lib-link-cvtres.write.1.tlog"
Lines="#(_LibWriteTlogLines)"
Overwrite="true"
/>
<ItemGroup>
<_LibWriteTlogLines Remove="#(_LibWriteTlogLines)" />
<_LibWriteTlogLinesToRemove Remove="#(_LibWriteTlogLinesToRemove)" />
</ItemGroup>
</Target>
The .tlog file's name seems to change depending on the input to Lib, so make sure that it matches your case.
I created new solution and new project (further A), added another external project (further B) Right click -> add existing project. Now, I have two projects (A & B) in my solution. I added also additional dirs to project A in order to it can see headers of project B. Then I added a few imports in file or project A from project B.
Then if I make right click on project B -> Rebuild it is built without any errors, then if I make right click on project B -> Rebuild I got an error that says :
1>------ Build started: Project: _DecoderEngine, Configuration: Release x64 ------
1>TetStreamDecoder.cpp
1>D:\land\co_main\_Infrastructure\Tier1.0\_FileCodec\_Decoder\_IDecoderCallback.h(3): fatal error C1083: Cannot open include file: '_Shared/_FileTypes.h': No such file or directory
1>Done building project "_DecoderEngine.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 2 up-to-date, 0 skipped ==========
What is weird that a file where I got an error it is a file from project B, it means if I make right click on project B -> Rebuild it is ok, but if I try rebuild project A that has import from B I got and error in files from project B...
What am I doing wrong? I feel like I miss something in configuration, maybe should I add something to Liker or something else?
EDIT
tree looks like this
FileCodec
|
-_DecoderEngine (project A)
|
-_Decoder (project B)
|
-_Shared
FYI - project A use project B and project B use Shared
Then, dependencies I have added to C\C++ -> Additional dirs to project A are :
../_Decoder
../_Shared
Looks ok, because Decoder engine reside on the same level in tree as dependency, so we need to go one level up and here you are.
I am using the odb compiler as a custom build tool. The build tool is always executing even though the input file is not changing.
The command line:
odb -Ic:\menuplan\src\ingredient -o c:\menuplan\src\ingredient
-d mysql --hxx-prologue "#include \"odb/traits.hxx\"" --generate-query
--generate-schema --schema-format separate
c:\menuplan\src\ingredient\ing_odb_category.hpp`
The input file is:
ing_odb_category.hpp.
The outputs:
ing_odb_category-odb.hxx;ing_odb_category-odb.ixx;ing_odb_category-odb.cxx;ing_odb_category-schema.cxx
The additional dependencies:
ing_odb_category.hpp
The description:
odb ing_odb_category.hpp
The output from Visual Studio 2010:
2>------ Build started: Project: vs_2010, Configuration: Debug Win32 ------
2> odb ing_odb_category.hpp
The odb tool takes the ing_odb_category.hpp as input and produces ing_odb_category-odb.hxx, ing_odb_category-odb.ixx,ing_odb_category-odb.cxx,ing_odb_category-schema.cxx files.
I can build the solution many times in a row and the custom build event will always run, even though the ing_odb_category.hpp file never changes.
How can I make Visual Studio only perform the custom build if the header file changes?
From the vcxproj file:
<CustomBuild Include="..\ing_odb_category.hpp">
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">odb -Ic:\menuplan\src\ingredient -o c:\menuplan\src\ingredient -d mysql --hxx-prologue "#include \"odb/traits.hxx\"" --generate-query --generate-schema --schema-format separate c:\menuplan\src\ingredient\ing_odb_category.hpp</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug_Static_Unicode|Win32'">odb -Ic:\menuplan\src\ingredient -o c:\menuplan\src\ingredient -d mysql --hxx-prologue "#include \"odb/traits.hxx\"" --generate-query --generate-schema --schema-format separate c:\menuplan\src\ingredient\ing_odb_category.hpp</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">odb ing_odb_category.hpp</Message>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug_Static_Unicode|Win32'">odb ing_odb_category.hpp</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ing_odb_category-odb.hxx;ing_odb_category-odb.ixx;ing_odb_category-odb.cxx;ing_odb_category-schema.cxx</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug_Static_Unicode|Win32'">ing_odb_category-odb.hxx;ing_odb_category-odb.ixx;ing_odb_category-odb.cxx;ing_odb_category-schema.cxx</Outputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ing_odb_category.hpp</AdditionalInputs>
</CustomBuild>
Environment:
Visual Studio 2010
Windows 7 - 64bit
Visual Studio was always building the files because it said they didn't exist.
Using the Visual Studio project logging article, especially running the DebugView showed that Visual Studio was using a different path for the dependencies. I did not specify the path of the output files and dependencies, so it was trying to locate them in the default project directory.
Also, Visual Studio expects only one output file, according to Specifying Custom Build Tools article. I was supplying all the output filenames.
Summary
In the Custom Build Tool window:
There should only be one output file.
Additional output files are listed in the Additional Dependencies
slot.
All output files should be prefixed with the path of their location,
relative or absolute.
Useful build process debugging aids can be found in the Visual Studio Project Logging article, especially the DebugView application.
In VS 2012, I start a DLL library project, add some code, hit Build and no DLL appears.
I know there are similar questions here on SO about the same topic, however
I have checked the output folder (set to the implicit *$(SolutionDir)$(Configuration)*)
Have not confused Debug and Release
etc..
The output folder does contain something after the build - a .lastbuildstate file and a .log file.
The content of the .lastbuildstate file is
#v4.0:v110:false
Debug|Win32|D:\Desktop\newOne\|
while the contents of the .log file is
Build started 16.10.2014 12:28:52.
1>Project "D:\Desktop\newOne\newOne.vcxproj" on node 2 (Build target(s)).
1>InitializeBuildStatus:
Creating "Debug\newOne.unsuccessfulbuild" because "AlwaysCreate" was specified.
FinalizeBuildStatus:
Deleting file "Debug\newOne.unsuccessfulbuild".
Touching "Debug\newOne.lastbuildstate".
1>Done Building Project "D:\Desktop\newOne\newOne.vcxproj" (Build target(s)).
Build succeeded.
Time Elapsed 00:00:00.02
I tried to create another DLL project from scratch, with the same code, and the result is the same.
Any help is much appreciated.
Daniel
Well in most cases people do look in the wrong directories (like in this issue) but usually the build log states the outputs but your log seems to be empty. What I would advice:
1) Check if your dll actually exports any symbols (functions/classes) - I am not actually sure if VS2012 generates the dll depending on the presence of exported symbols, but still
2) If you are build the whole solution not just the project check that the DLL project is actually marked to be built (a small chance but still)
UPDATE
I checked that symbol exports do not affect the producing of a dll - I set up an empty project and added some functions that are not exported and still got a normal build log:
1>------ Build started: Project: EmptyDllTest, Configuration: Debug Win32 ------
1> Source.cpp
1> EmptyDllTest.vcxproj -> c:\users\user\documents\visual studio 2012\Projects\EmptyDllTest\Debug\EmptyDllTest.dll
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
I can reproduce the log you have only with a totally empty solution. Any chances that for some reason you have not added the source files to the project or they are excluded?
i have downloaded gSOAP 2.8.17r stable (update) (20.7 MB)
in /bin/ there are 2 exe wsdl2h.exe and soapcpp2.exe but they
work only with non secure website,now for secured wsdl2h.exe there is a source code in gsoap/VisualStudio2005/... which we have to compile. While compiling i am getting errors
i have already installed minGW,bison,flex,m4,perl,....
also created build custom tools for .l and .y files in the project soapcpp2
as given in readme file.
-------Read me ---------
Flex and Bison for Windows
==========================
Visual Studio 2005 Solution files for soapcpp2 and wsdl2h are included.
If not already installed, install the Platform SDK (R2) for `winsock2.h`.
To build `soapcpp2.exe`, first install Bison and Flex (in the default dirs):
<http://gnuwin32.sourceforge.net/packages/bison.htm>
<http://gnuwin32.sourceforge.net/packages/flex.htm>
then add the FlexBison.rules as explained here:
<http://msdn2.microsoft.com/en-us/library/aa730877(VS.80).aspx>
These custom-build rules are used to build the scanner and parser for
`soapcpp2.exe`.
To build `wsdl2h.exe`, you first need to build `soapcpp2.exe` and install it in
Program Files or copy it to the `wsdl` directory. This is needed to execute the
custom-build step on `wsdl.h` to generate `wsdlStub.h`, `wsdlH.h`, and
`wsdlC.cpp`.
Build Rules for `soapcpp2.exe` VS 2008 and 2010
===============================================
To build `soapcpp2.exe` you need to install Flex and Bison. To do so, you need
to create custom build rules to compile `.l` and `.y` files with Flex and
Bison.
Please see:
<http://msdn.microsoft.com/en-us/library/aa730877(VS.80).aspx#vccustombr_topic3>
In VS2008, there is UI available to help you create the custom build rule.
Make sure you have `flex.exe`, `bison.exe`, and `m4.exe` on the system search
path.
- Right click on the `.l` file and select properties
- Configuration -> All Configurations
- General -> Item Typ e-> Custom Build Tool
- Apply
- Custom Build Tool -> General -> Command Line -> `flex -olexer.c lexer.l`
- Custom Build Tool -> General -> Outputs -> `lexer.c`
- Custom Build Tool -> General -> Additional Dependencies -> `parser.y parser.c`
- Apply
- Select the `.y` file in the solution explorer
- Configuration -> All Configurations
- General -> Item Type -> Custom Build Tool
- Apply
- Custom Build Tool -> General -> Command Line -> `bison -oparser.c parser.y`
- Custom Build Tool -> General -> Outputs -> `parser.c parser.h`
In VS2010, there may not be a UI available to create the custom build rules.
To add or modify build rules in VS2010 you need to edit:
`%ProgramFiles%\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations`
and/or
`%ProgramFiles(x86)%\MSBuild\Microsoft.Cpp\v4.0\BuildCustomizations`
----------- Error -------------
1>------ Build started: Project: soapcpp2, Configuration: Debug Win32 ------
1>Performing Custom Build Step
1>bison: cannot open file `parser.y': No such file or directory
1>Project : error PRJ0019: A tool returned an error code from "Performing Custom Build Step"
1>Build log was saved at "file://c:\gs\gsoap-2.8\gsoap\VisualStudio2005\soapcpp2\soapcpp2\Debug\BuildLog.htm"
1>soapcpp2 - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
To build soapcpp2.exe you need to install Flex and Bison. To do so, you need
to create custom build rules to compile .l and .y files with Flex and
Bison.Please see:http://msdn.microsoft.com/en-us/library/aa730877(VS.80).aspx#vccustombr_topic3.
You can download Win flex-bison from sourceforge, when you compile soapcpp2 with VS you should setup custom build rules,please see https://sourceforge.net/p/winflexbison/wiki/Visual%20Studio%20custom%20build%20rules/
Good Luck!
I suppose that parser.y and lexer.l are just wrong names for soapcpp2_lex.l and soapcpp2_yacc.y files we have in soapcpp2 project.
So just correct "Command Line" for both files:
for '.y' file: bison -oparser.c $(InputFileName)
for '.l' file: flex -olexer.c $(InputFileName)