Xcode's feature similar to Visual Studio's add reference? - visual-studio

I asked about debugging dylib in Xcode in this post. For Visual Studio, I can use the 'Add New Reference' in Property pages to assign a dynamic library project from the project that uses the library. And, I can put all the project in one single solution file, and make the project as 'Startup Project'. I just set breakpoints and run to debug the dynamic library.
Can Xcode do the similar/same thing?
Can Xcode have two or more projects in one something like VS2010's solution file?
Does Xcode provide something like referencing project to debug dynamic library?

Can Xcode have two or more projects in one something like VS2010's solution file?
You can include an Xcode project in another Xcode project. Just use the Add Existing File action to add it. Then you can reference any of the included project's build products.

Related

How to link a static library in Visual C++ 2017?

Trying to set up libtins on windows. Im relatively new to Visual studio and most of the documentation on the matter was for older versions. I was able to get the include files set up with the project but linking the .lib's was problematic and i cant seem to configure it properly. The properties menu seems pretty convoluted as im used to doing most things compiler related configurations from a command line.
In the Solution Explorer, right click on the project, select Properties. Expand to Configuration Properties > Linker > Input. Add the .lib file to Additional Dependencies. Do this for both the Release and Debug configuration.
If the static library in question is in fact the output of another visual studio project, you can just add that project to your solution file, and then add a reference to that project, and let VS2017 figure out where the lib files are located, and that the linker needs them.
i.e.
Solution '...' (2 projects)
Lib Consuming Project
References(Lib Producing Project)
Lib Producing Project
hint for creating static libraries from visual studio
for Lib Producing Project, go to Properties
Properties->Configuration Properties->General
and set Configuration Type to static lib (for both debug and release)
for foreign static libs, the accepted answer is AFAIK the proper way to do it.

Can't reference PCL library within Xamarin Studio

I'm trying to build an Android and iOS app with Xamarin using a shared PCL library. I'm following the tutorial on the Xamarin website [1].
I have created my PCL solution, which currently doesn't do anything, and I'm now trying to reference it from another Android solution.
The documentation indicates I should use References and then select Projects. However, when I do this, I can't either see or find a way to add my PCL library project as a reference.
How can I add my PCL library solution as a reference in another solution?
[1] http://developer.xamarin.com/guides/cross-platform/application_fundamentals/pcl/introduction_to_portable_class_libraries/#Using_PCL
A solution is just a container for one or more projects. One project can be included in multiple solutions. By including multiple projects in one solution you can reference them from one another, which will allow them to automatically build/update their dependencies when needed. You can add a new project to an existing solution by doing "Add New Project" in the solution explorer - you don't have to create a complete new solution for each project.

Visual Studio not able to run ".lib" file?

I am trying to build a project from the following Source Code (it accompanies a book I am currently reading). Unfortunately, visual studio can not run a library with the name "cyclone_d.lib". I believe this is because visual studio simply can not locate the file. I have spent several hours trying to fix this problem by changing the settings in the linker and project, for example adding Additional Directories, but I have not been able to get any results.
Please let me know how I can fix this problem and compile the code.
Thank You!
Your link to source points only to some Unix-style source files but no VS project files. So I can only guess and give general help.
A VS solution contains one or more projects. Each project has a build target, in most cases a EXE, DLL, or static library LIB. When you have a solution that includes an project with an EXE build target set the option "Set as StartUp Project" at that project in the solution tree.
If you don't have an EXE change your project setup to create a Win32 executable instead a library. For this task the most simple approach is creating a new project (Win32 Console Application or Win32 Project) and add all the source files.

using Qt designer in visual studio?

I'm using visual studio 2010, Qt add-in etc all ok, then create new project using Qt add-in... when doubleclicking *.ui (the actual form) file in VS it opens Qtdesigner, then I put some controls on, but that does not change my code at all :/
Qt form is changed it contains those controls but source files are the same as before even after building my project.
I'm I missing something?
I think Qtdesinger shoult put some code for objects which I created using Qtdesigner.
cos without that we must write all the code as if there were no Qtdesigner so Qtdesinger is useles in Visual studio, the same thing we could just do by hand-coding a form interface.
thanks alot.
EDIT:
OK
I've copied this from Qt site:
You are referencing objects from a .ui file...
The Visual Studio code model parser only parses C++ sources, meaning
that widgets or objects defined in .ui files will not be accessible.
To workaround the problem, the Qt Visual Studio Add-in automatically
generates C++ code from the .ui file by saving the file and running
uic on it. This step is done everytime the project is built. If the
code completion does not work, try to rebuild the project. It is
possible that you have to wait some time, before code completion fully
works after updating an .ui file. For more information, you can refer
to the Modifying Project Properties section. It still does not work...
You should refresh the code model, Intellisense. This is done by
opening the solution explorer, invoking the context menu of the
project and activating the item Update Intellisense.
now it looks that I'm having such problems but this does not help at all, update intelisece. I can't see such option in visual studio,
it looks my visual studio add-in isn't working.
it says "You should refresh the code model" Woot? can someone explain me how to do that please.
here are some output warnings when building my project:
Warning 1 warning : No resources in 'C:\Users\Admin\documents\visual
studio
2010\Projects\VisualStudio\test\test.qrc'. C:\Users\Admin\documents\visual
studio 2010\Projects\VisualStudio\test\RCC Warning 2 warning LNK4099:
PDB 'vc100.pdb' was not found with 'qtmaind.lib(qtmain_win.obj)' or at
'C:\Users\Admin\documents\visual studio
2010\Projects\VisualStudio\vc100.pdb'; linking object as if no debug
info C:\Users\Admin\documents\visual studio
2010\Projects\VisualStudio\test\qtmaind.lib(qtmain_win.obj)
I'm going to explain a little bit how things work and the relationships between the files, and hopefully this will solve your problem.
When you edit the ui file using the designer all changes are made to the ui file itself. Then when you build a couple of things will happen.
First... a custom build step will be run on the ui file. This build step runs "uic" as Macke said, and will generate a file called "ui_thenameofyouruifile.h". Where this file is located depends on your project settings, but if you look in your project you should see a folder called Generated Files in your project.
If you look in there you should see the newly generated file. This is the code that is "changed" when you make changes to your form. Now if this file is not updated, or does not exist at all, then somehow your project settings got messed up. In this case I would remove your .ui file from the project and re-add it. The add-in should do it's magic and add all the stuff you need. Build again and it should work. (I assume that is probably your problem)
The second thing that should happen when you build, is that the class that uses your ui file should recompile. Generally when you create a ui file, you also create an accompanying .h and .cpp file. This is where we do any of the fun logic that we might need in our window. The Qt designer will never ever change this class.
In the header file we refer to the ui file by doing this:
namespace Ui {
class thenameofyouruifile;
}
#include "ui_thenameofyouruifile.h"
and then we add a member variable
Ui::thenameofyouruifile UI;
There are a couple of ways to do this, but basically that's the idea. The add-in is supposed to configure your project so that the directory where the generate files go is included in the "additional include directories" in your project settings, but that is another place to check to make sure that your code is really linking with the correct generated file.
If Qt Add-In installed properly, it should generate the custom build step for Qt related files (.ui or moc file). I have not tried Qt Add-in with VS 2010, but with VS 2008 it's okay.
The work-around for your problem, you need to add manually the custom build step for each ui file you have in the project. To do this, the step is:
Right clicked the ui file, and click the properties (I'm using VS-2008 to do this step, and expect this may not be much different in VS 2010).
Under custom build step, add this in the command line: "$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_$(InputName).h" "$(InputPath)"
And add this under output: ".\GeneratedFiles\ui_$(InputName).h"
And this under additional dependencies: $(QTDIR)\bin\uic.exe. Then click apply / ok.
If this is done, the ui file is compilable, (when you right click it, it can be compiled), so when the ui file content change, the new ui code (.h) file is regenerated.
Alternatively, to reset the VS project file (vcprojx) you can create Qt project in Qt creator, (or if you have already one), and then convert the Qt creator project (.pro) into vcproj using this command line:
qmake -spec win32-msvc2010 -tp vc
This will create the vcproj with the proper custom build step for you (in case you have many ui files, then you don't need to do the first approach).
If you've created a Qt widget using the new class wizard, stuff should work as expected.
I.e. your .ui files are compiled by Qt's uic to .cpp files, i.e. you need to build your project to get these changes into the ui-class.
So, the .ui files should be added to the project, and have some special build rules that invoke 'uic' on them. If that's not the case, try and re-add them to your project (that way, the Qt add-in should configure the build rules)
Normally, you have a class that inherits QWidget which then includes the compiled cpp-class, by one way or another, usually as a member variable (but inheritance is an option too).
Adding an .ui-file straight up should work too (if you're in a Qt project, which you are..), but obviously something is wrong.
Does the example projects work as expected?

Reuse project properties for a new project

Lately I've been working on a C++ project in Visual Studio. I had to configure the project in every detail: libraries, linker options, optimization, optional compiler setting etc...
Now I'm moving to another similar project and I'd like to reuse the settings of the current one without manually setting them again.
You do this with a project property sheet. I typed up an answer recently to show how to use them.

Resources