Can not open include file; no such file or dir - c++

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.

Related

Separate dll from other output files in c++ projects

I have a few dll projects in a solution (some depending on each other)
Project1 -> Properties -> Linker -> Input -> Additional Dependencies -> Project2.lib
Project1 -> Properties -> Linker -> General -> Additional Library Directories -> $(OutDir)
All is working fine.
Projects are Win7Debug Win32, Win7Debug x64..... and a Win32 project with only Debug and Release configurations.
I would like to have all dll's for Win32 placed in one folder and the x64 ones in another folder. So I added the x64 configuration for the Win32 project, and changed
Project1 -> Properties -> Linker -> General -> Output File -> $(SolutionDir)/i386/$(TargetName)/$(TargetExt)
(for Win32 - similar change for x64)
all seemed fine - and I only received dlls in the i386 folder... until I had to rebuild and got
Warning 23 warning MSB8012:
TargetPath(C:\Path\Win7Debug\Project1.dll) does not match the Linker's OutputFile
property value (C:\Path\i386\Project1.dll). This may cause your project to build
incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and
$(TargetExt) property values match the value specified in %(Link.OutputFile).
This seems serious... and I don't want to have problems with missing dependencies (though everything seems to be working fine - and not just on my machine)
I changed
Project1 -> Properties -> Configuration Properties -> General -> OutputDirectory -> $(SolutionDir)/i386
(to match the linker output) but now of course I get lib and exp files in the same folder as the dll's.
Other than using post build script, is there a way to separate the output files ?
Should I just leave the settings how I had them and disregard the warning above ?
Note: I am not trying to separate the Platform/configuration output files... That is done automagically using the default output directory.
What I need is, for each platform, to place only DLL files in one folder away from anything else. Redirecting Linker output (and leaving project output to standard) accomplishes that - I just am not sure if it is correct. Logically I should not have any build problems since I am giving linker all the info it needs...
The standard approach is to leave all these properties unchanged (inherit from parent). In this case linker will create DLL and LIB in $(Output) directory, which by default is $(SolutionDir)$(Configuration).
You just specify the name for x64 configuration, and all output files will be separated automatically.
The standard (and the easest) way to link import library is to add reference to corresponding project in Common Properties / References page. Nothing else is required.
If, for any reason, it is impossible, add $(SolutionDir)$(Configuration) to Configuration Properties / VC++ Directories / Library Directories and add library to be linked to Linker / Additional Dependencies. If there are many projects in your solution, you may create Property Sheet for the solution and specify Library Directories only once.

DLL Building in VS2012 - no DLL file appears

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?

cant compile secured version of gsoap

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)

What files belong to a build target in CDT managed build?

In CDT's managed builder, how are individual files assigned to build configurations?
Specifically, how can I:
indicate that configuration A has to build and link sources from folders A and B, while configuraion B shall use folders A and C,
include sources (not headers) from a referenced project (or just any external source files?) to be also built and linked as a part of a given project?
1st point, assuming there are 3 folders A,B & C containing .cpp files, try this :
select folder C in the 'project explorer' pane, right-click > exclude from build... > check configuration A > ok
select folder B, right-click > exclude from build... > check configuration B > ok
This way configuration A will ignore .cpp files from folder C and configuration B will ignore folder B.
2nd point : maybe you could use import > general > file system to import source from an external folder into your project ?

Compile Combination of qtwinmigrate + qtpropertybrowser Under VC++ 2008

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.