can anybody help me how to use png++/libpng in a Visual Studio Project?
For Linux there are several tutorials and examples, but for the usage in a Visual studio project I found no help.
My CMakeLists.txt-file looks this way:
# project
cmake_minimum_required (VERSION 2.6)
project (libviso2)
# directories
set (LIBVISO2_SRC_DIR src)
# include directory
include_directories("${LIBVISO2_SRC_DIR}")
# use sse3 instruction set
SET(CMAKE_CXX_FLAGS "-msse3")
# sources
FILE(GLOB LIBVISO2_SRC_FILES "src/*.cpp")
# make release version
set(CMAKE_BUILD_TYPE Release)
# demo program
add_executable(viso2 ${LIBVISO2_SRC_FILES})
target_link_libraries (viso2 png)
Using CMake GUI and the above CMakeLists.txt-file I can generate a Visual Studio Project that works fine for itself until the png++-algorithms are handled in the code (build error). So basically my problem is that I have no experience in CMake and png++/libpng.
I have two folders downloaded from the web, one folder png++ and one folder libpng.
In these two folders there is all the code for the two libraries.
So my question is:
Could anybody explain to me how to arrange/include these two folders in a Visual Studio project producing no error, this could be a very simple project starting:
#include "png++/png.hpp"
using namespace png;
How would I edit the CMakeLists file in order to build a Visual studio project in which the png++ and libpng folders are correctly included so as to make it feasible to use the png++ code?
Thank You in advance for any help!
png++ is a C++ wrapper for libpng library, so it only has header files.
what you need to do is to compile libpng and its dependency(zlib).
and include header files of png++, libpng and zlib, add library of libpng and zlib.
That's all you need, I ran libviso2 successfully on Windows, good luck!
Related
I am able to CMake build this HelloWorld example project using cmakelists.txt file and generate a visual studio project.
project(helloworld LANGUAGES C CXX)
cmake_minimum_required(VERSION 3.5)
find_package(Idlpp-cxx REQUIRED)
if (NOT TARGET CycloneDDS-CXX::ddscxx)
find_package(CycloneDDS-CXX REQUIRED)
endif()
# Convenience function, provided by the Idlpp-cxx that generates a CMake
# target for the given IDL file. The function calls Idlcpp-cxx to generate
# source files and compiles them into a library.
idl_ddscxx_generate(ddscxxHelloWorldData_lib "HelloWorldData.idl")
add_executable(ddscxxHelloworldPublisher publisher.cpp)
add_executable(ddscxxHelloworldSubscriber subscriber.cpp)
# Link both executables to idl data type library and ddscxx.
target_link_libraries(ddscxxHelloworldPublisher ddscxxHelloWorldData_lib CycloneDDS-CXX::ddscxx)
target_link_libraries(ddscxxHelloworldSubscriber ddscxxHelloWorldData_lib CycloneDDS-CXX::ddscxx)
set_property(TARGET ddscxxHelloworldPublisher PROPERTY CXX_STANDARD 11)
set_property(TARGET ddscxxHelloworldSubscriber PROPERTY CXX_STANDARD 11)
I need to create the same project without cmakelists.txt and CMake
How to do this only using visual studio? where to define those commands in CMakelists.txt in visual studio if I create an empty c++ project
I have tried this making an empty project.
I don't know how to idl_ddscxx_generate and target_link_libraries perform in VS....
idl_ddscxx_generate has to run if IDL file has changed
target_link_libraries is required if I added new source files to the project....
Make a new, empty Visual Studio project.
Copy all source files except the CMake files.
Do whatever you do in a Visual Studio project. Add files, targets, dependecies, … If you are not sure, look up what is written in the CMakeLists.txt file.
Delete all CMake files in your original project and copy your Visual Studio project files.
Add these changes (deleted CMake files, added VS project files) to your Subversion repository, maybe do this in a branch that others can test it, report back, and improve the change. Once done, merge the branch.
Probably, add step 0.: Learn how Visual Studio organizes its project. Make a tutorial, take some training.
Remark: Whatever your problem is with CMake, you missed something. But you can find this out later and revert your changes and pick up CMake up again.
I'm trying to build libpng in MS Visual studio 2015 community edition but when i built it, i got this error (i used cmake to compile libpng along with compiled zlib to produce libpng's soln file ALL_BUILD.vcxproj )
Cannot open include file: 'pnglibconf.h':No such file or directory
I think this a system specific error,when i try to build this on other system it works fine(because pnglibconfig.h was present with MS VS soln folder). Is there any prerequisites that is missing? Update: I tried building libpng in both debug & release mode, both are showing the same error. Zlib builds fine.
Try to add the folder where the png lib headers are to your include list in the VS project settings
If you aren't using "configure", you may need to copy pnglibconf.h.prebuilt from the scripts directory to pnglibconf.h in your working directory. See Section III of the INSTALL file in your libpng source directory.
I am trying to install OpenCV 3.0 Aplha. I'm following these instructions
http://docs.opencv.org/trunk/doc/tutorials/introduction/windows_install/windows_install.html
After I download and extract the package, I am supposed to have all the pre-built libraries in the folder :opencv\build\x86\vc12\lib but I don't see them in this folder. This folder only has opencv_ts300.lib and opencv_world300.lib. All the other libraries seems to be missing. Also the bin folder doesn't have the dlls. But statlib folder does seems to have all the static libraries.
I also tried to build the libraries from source, and as per the instructions after building the OpeCVALL.sln in visual studio, I am supposed to have the libraries in the x86\vc12 but the libraries doesn't seem to be building in this folder. After digging through the folders I see that the opencv libraries are found in bin/debug and bin/release folders. I thought I would use these for linking in visual studio but I am not finding the header files in build/include folder
I don't see any of these issues with Opencv 2.49. Any help in debugging this issue with 3.0 would be highly appreciated.
Summary: After I build from source/ or pre-built package, I am able to run the sample applications. But I am not finding the headers and libraries to create a visual studio project from scratch.
Okay I figured out what is going wrong here...
Build INSTALL project manually from the OpenCV.sln by right clicking - > build. This will create the libraries in build/install/x86/vc12 folder. This is where lib,bin and staticlib folders are now residing. Also the include files are in build/install/include.
Library files : located in your cmake folder's lib/debug(or release) folder
DLL files : located in cmake folder's bin/debug(or release) folder
Header files : located in opencv3's build/include folder
I am open to either a Visual Studio answer or a MinGW answer. I just finished building LLVM 3.2 using CMake and Visual Studio 2010. Everything went smoothly, but I have no llvm-config. Do I need it? Every example I see on the intertubes makes use of that tool. If I don't need it, how do I configure my project to make use of LLVM?
To be clear, I am not trying to use LLVM tools/compilers (like clang and whatnot). I am trying to write C++ code that uses the LLVM libraries to produce LLVM IR and even compile that stuff. I setup my include and lib folders. I ran llvm-config in Linux and saw a long list of macros and libraries.
I have a wonderful folder full of goodies. It just has no llvm-config in there: C:\Program Files (x86)\LLVM\
llvm-config does not exist in windows prebuilt binaries. You need to compile from the source code to get it.
Grab CMAKE > 3.5 , install it and make sure you add it to PATH.
Download Visual Studio 2019
Donwload the source code (9.0.1 is the latest as I'm writing this)
Extract the source code
Cd into the root of the llvm source-code
In cmd, type cmake . this will generate Visual Studio 2019 sln.
open sln file(LLVM.sln), change the build type to Rlease, build the whole project
navigate to your Rlease\bin, and there you have your llvm-config.exe
If you have built the LLVM in debug version all the executables (including llvm-config) have been placed in your build directory (containing Visual Studio project and solution files) in bin/Debug/ subdirectory. In case of release build replace Debug with Release.
If you are interested in using LLVM on Windows more than building it, check out Windows snapshot builds.
I opened up the solution file in the [InstallDir]\_make\opencv.vs2005 and modified one of the .cpp files in the highgui library.
While compiling, Visual Studio throws the error -
Unable to start progam
C:/Users/../AppData/Local/Temp/opencv.build/cv_Debug.Win32/cv.dll
The system cannot find the file specified.
I think I am missing something in it. What is the stepped procedure to change and recompile OpenCV library using Visual Studio.
I would appreciate any help!
Thank You..
Unless you downloaded the visual-studio specific version of the open cv distribution files, you need to follow the instructions on the OpenCV wiki, that is
download cmake
have cmake generate makefiles/solutions
build using the generated files
I guess you want to customize a function. You can do this, without recompiling OpenCV from scratch. You can simply copy the .cpp source file locally in your current working directory, and add it(click n drag or add existing file) in the "Source Files" in your project. You might need to copy some other headers as well. You will find everything in the opencv archive. (opencv/modules/highgui/src)