I am trying to incorporate libsodium into my C++ project in Xcode. I am following the Installation instructions here: https://libsodium.gitbook.io/doc/installation
However, I'm not sure where the "installed" files go on my machine or how to then incorporate them in my Xcode project. The libsodium website is not helpful. Could someone help clarify for me please?
I have downloaded the latest stable release, unzipped it, and typed the following code into the shell:
./configure
make && make check
sudo make install
It seems that the configure, make and install processes go smoothly. I expected the next steps to link to Xcode would be clear, but they are not, and I am lost. Can someone point me in the right direction?
When you perform the sudo make install step, the library files will be installed into the location the ./configure step designated. By default, this is usually /usr/local/lib.
You will still need to add the library files to your XCode project.
Try reading Link a target to libraries and frameworks about how to add the libsodium libraries. Pay attention to the "Add Other..." button which will allow you to navigate to the location you installed the libraries.
Hope this helps!
Related
Firstly, I know nothing about C/C++, but I am trying to compile LCI https://github.com/justinmeza/lci under Windows 10 with Visual Studio 2015, but I'm getting the following error:
Cannot open include file: 'getopt.h': No such file or directory.
I see that getopt is not part of Visual C so people are saying you have to implement your own. It looks like this is what I need:
https://github.com/skandhurkat/Getopt-for-Visual-Studio/blob/master/getopt.h
Problem is, I don't really know what to do with this file. I've been reading a fair bit and messing around for ages just to compile lci.exe!
Already emailed the OP about this, but here's the steps I followed in order to build lci successfully. The missing step seemed to be that Justin Meza neglected to mention that you need to install CMake as well in order for the install script to work. CMake will allow you to build C code against the glibc headers.
Install MinGW
Install Python 3.5.1 (or latest Windows version)
Install Git for Windows (if you haven't already)
Make sure to enable Git for the Windows command prompt
Install CMake
Add MinGW and Python to your PATH environment variable. I'd double check that your paths to the executables are correct, mine looked like this:
C:\Program Files\mingw-w64\mingw64\bin
C:\Users{username}\AppData\Local\Programs\Python\Python35-32
Run a command prompt as administrator, and go to your Documents folder and clone the lci repository (if you haven't already):
git clone https://github.com/justinmeza/lci.git
Go into the lci directory, and run:
install.py --prefix="C:/Program Files/lci"
Add lci to you PATH, if using the default location add this to the end of your PATH:
C:\Program Files\lci\bin
I would have included some links to the various programs above in steps 1-4 but apparently I don't have enough reputation on StackOverflow for that...you should be able to find them easily enough in a quick Google search.
You should now be able to run lci from any command prompt. A good test would be to run the "HAI WORLD" code at lolcode.org.
Just copy getopt.h to the directory where .c files are, so the compiler can find it.
Based on the linked source code and it's contents, the project you're trying to build appears to be written for Linux. It might be possible to sufficiently rewrite it to be able to compile under Microsoft Windows, and Microsoft's compiler; or perhaps install something like MinGW.
However, given your stated lack of development experience, this does not appear to be something that you could easily handle on your own.
I am trying to get my head around some basic concepts, but I can't seem to figure them out.
I am really confused over what it means to install (I think they are called libraries) for C++. I am trying to install OpenCV, but I don't know what needs to happen for it to be installed, how to check, or what really OpenCV is (Is it a library, framework, something else?).
My understanding is that OpenCV (and other libraries/frameworks) is distributed as only the source code so that is is able to work cross-platform. Then, after you download it, you have to build it (I don't know what build means though), and then link your compiler against it so that it can access the files? I don't know how any of this would be done, or really what this means. I think a lot of this is done by CMake, but I don't know what CMake really does, how you would use it, or how you would then utilize the library/framework in your code. Also, where would the libraries like OpenCV be installed, how would clang (or any other compiler/linker) know where to find them, and what kind of files would they be (.a, .dylib, .cpp, .hpp, executables, or a collection of everything)? Is this structure specific to C++ and OS X or is it more widespread?
I am not looking for a tutorial on how to install OpenCV or other libraries, but I am instead trying to learn how that actually works so I won't need tutorials in the future.
Before you can do any C/C++ development work on a Mac, you need to go to the App Store and download Xcode for free - it is Apple's IDE - Integrated Development Environment. Without Xcode, you will have no compiler (i.e. clang or gcc or g++) and no build tools, (i.e. make).
Install Xcode
If you are totally new to Mac, App Store looks like this:
and Xcode looks like this:
Install Command Line Tools
Next you must install Xcode's command-line tools, so start a Terminal - by pressing ⌘+SPACE and starting to type Terminal and when it guesses correctly, just hit Enter/Return. Copy and paste the following into Terminal and hit Enter/Return.
xcode-select --install
The above is called a "Spotlight Search" and is the easiest way to find anything on a Mac.
Install homebrew
Then, if you want to install OpenCV on a Mac, install a package manager such as homebrew which is a matter of copying and pasting a single line from the homebrew website into your Terminal. I will not show the line here in case it ever changes and someone looks at this in a few years, but it is easy to see if you go to the link above.
Find Packages
Then you can find any packages you want with:
brew search opencv # Look for packages called "opencv"
or
brew search boost # Look for "boost" libraries
Install OpenCV
So, for a vanilla (no special options) installation and build of OpenCV do this:
brew install opencv
Remove Packages
You can later remove any packages you no longer want with:
brew rm opencv
Update Packages
You can also update all installed packages with:
brew update && brew upgrade && brew cleanup
Build a Project
Once you have got it installed, you can start compiling and building your own project. It helps if you use the pkg-config package to pick up all the necessary compiler/linker settings you need, so I would suggest:
brew install pkg-config
Now you can compile and link with a really simple command like:
g++ $(pkg-config --cflags --libs opencv) process.cpp -o process
Then you can go on to use Xcode IDE later if you want to once you get started.
Build with Xcode
Once you have got started with basic compilation, you may want to start using Xcode to edit your programs, to do that, you must tell Xcode where the header files are and also where the libraries are and which libraries to link. This will vary with your OpenCV version, but you will need to alter the places marked in the two diagrams below. You will find these easily if you click them in order - green area first, then the yellow, then the blue, then the red.
The actual information that will need to go in the Xcode settings areas I have marked above can be found by running the same pkg-config command I suggested in the previous section. So run:
pkg-config --cflags opencv
to get the location of the header (include) files, and then run
pkg-config --libs opencv
to get the information you need to fill in for the linker in Xcode.
I've downloaded dicom3tools in Ubuntu apt-get install dicom3tools, but certain apps are not present.
I've downloaded the source and compiled according to directions on Ubuntu without errors. I have access to most of the apps in the kit, but some just seem to be missing or not compiling.
I need a working binary copy of the pbmtoovl tool from this kit.
Can anyone help me?
Do you know why it is missing?
Do I need to compile differently?
Do you have a copy of the pbmtoovl app pre-compiled?
There is no info on this anywhere on the web, I have nowhere else to turn.
Thanks in advance for any info on this.
Please please help me with this.....
I edited the proper file with a uid.
I ran
imake -I./config -DInstallInTopDir -DUsemyID
and everything looked fine.
make World.
make install
make install.man,
but still no rawtodc or pbmtoovl or any of the dicom creation tools. I really need these tools. Please let me know what I'm doing wrong. On Ubuntu 14 –
I am the author of the dicom3tools debian package. The explanation is given online here.
When you install a debian package, you are required to read the documentation. In this case the documentation was available on your system from:
$ cat /usr/share/doc/dicom3tools/README.Debian
So you'll need to follow the build instructions yourself (see INSTALL):
Edit config/site.p-def to set your UID root (a la UseClunieID, to be
selected with a UseXXXXID define on the imake command line).
NB. Don't ever use any UseClunie*ID or your instances
will conflict with mine !
./Configure
setenv IMAKEINCLUDE -I./config # only needed for suns
imake -I./config -DInstallInTopDir -DUseXXXXID
make World
make install # into ./bin
make install.man # into ./man
I finally did a fresh Ubuntu install, installed xutils, g++, gcc and ran the compiling instructions. It did not install, again, but this time I did have a new directory in bin ending in 'unknown' that miraculously contained all of the compiled binaries. I added that dir to the PATH and VOILA I can access all the tools from the command line....
It's still a problem, but I can now use pbmtoovl
I have tried the this tutorial but it did not help me out. I have installed Cygwin and added its C:\cygwin\bin path in my environment variables but nothing happened, still the same error.
and its not even recognizing cout.
The configuration page lists the required cygwin packages:
gcc
g++ (gcc-g++ package)
gdb
make
Make sure those packages are installed by re-running the Cygwin Setup and checking those packages in the Select Packages step. Look under the Devel category or search for the packages in the Search field.
If the packages are marked "Skip" then they are not installed. Click the skipped packages until a version number appears where "Skip" did.
Then, click Next, let Cygwin install any dependencies, and click Next again to download and install the packages.
I installed the wxWidgets source code, compiled it and am linking the libraries thus obtained with my application code. Now I need to use OpenGL in my wxWidgets application. How do I enable this?
For building on Windows with project files:
Assume $(WXWIDGETSROOT) is the root directory of your wxWidgets installation.
Open the file $(WXWIDGETSROOT)\include\wx\msw\setup.h
Search for the #define for wxUSE_GLCANVAS.
Change its value from 0 to 1.
Recompile the library.
For building on Linux and other ./configure based platforms:
Just use ./configure --with-opengl
(A mashup answer from two partial answers given by others)
If you're using configure to build wxWidgets you just need to add --with-opengl to your command line.
Just to add a little bit... If you're on linux you need to watch the logs when running configure. If it can't find opengl dev packages then it will turn opengl off with one line of warning which is easy to miss.
run it like this to make it more obvious what development libraries you're actually missing (it looks like the --with-opengl is on by default in 3.0.0 and possibly earlier versions of wxwidgets, but it can't hurt to include it I suspect).
./configure --with-opengl > configure.log
Once configure can find all the dev libs you think you're going to use you need to rebuild wxwidgets:
make
sudo make install
I had to install these on linux mint to make wxwidget's configure happy as far as opengl was concerned (and should also work for ubuntu) to get the dev libs I needed.
sudo apt-get install mesa-common-dev
sudo apt-get install freeglut3-dev
(Assume $(WX_WIDGETS_ROOT) is the root directory of your wxWidgets installation.)
Open the file $(WX_WIDGETS_ROOT)\include\wx\msw\setup.h
Search and find the option wxUSE_GLCANVAS. Change its value from 0 to 1.
Recompile the library.