Why prebuilt of protocol buffer doesn't contain any header files - c++

I am using protocol buffer first time. I am able to make and compile .proto
file from protoc (protoc-3.9.1-win64). But problem is that when i want to use
compiled files i am getting error google/protobuf/*.h not found even i have
setup include path to ./protoc-3.9.1-win64/include.
include folder of protoc's contain only contain .proto files
there are no header files in it ?
do i need to build from source ?

You have downloaded the package for the protoc compiler.
However, the C++ library is in separate package, protobuf-cpp-3.9.1.zip, where cpp stands for C++. There are multiple packages available for other languages, too.

Related

No .lib and .dll found, but .h is there

So I'm trying to use RtAudio to read microphone input in real time, but the problem is that when I download the .zip file, I found the header files but there is no .lib files or dll, and I need them Link with my project, where are they?
I'm a beginner in cpp:)
This is the RtAudio
https://github.com/thestk/rtaudio
You seem to have downloaded a copy of source code repository. Compiled binaries such libraries are not stored in such repositories. That's why you won't find them there.
In order to get the compiled libraries from the source code, you must compile i.e. build the source code. Each project has their own way of building from source, although there are common patterns. The frontpage that you link to contains instructions on how to build that project. The instructions to build it are under the heading "Building".

Including c++ header files in Xcode without adding the compile source

I'm working to create my own c++ library. I've noticed that I have to add my source file to Compile Sources under Build Phases in Xcode if I include the header file. Obviously, I don't have to go find every Boost or Curl file that I use when including one of those header files.
Currently, my "library" consists of a few header file and source files in the same folder. I have added the path to find the header files to header search paths.
What's the difference between what I'm writing and the standard libraries that only need header file references?

Should I install jpeg library when I use Generic Image Library in BOOST

I have a question related to Generic Image Library in BOOST. At the beginning of using the library, I try to read a jpeg image using the following codes:
rgb8_image_t img;
jpeg_read_image("test.jpg",img);
However, when I compile the codes, I have the following error:
error C1083: Cannot open include file: 'jpeglib.h': No such file or directory
I find the jpeglib.h is not a file inside the library, and therefore I think it is mandatory to install the jpeg library when using this library. However, when very little information about it can be found in the Internet. I am now using the library with VC10 in the windows environment, and should I compile the JPEG library before using the Generic Image Library? Furthermore, should I compile the JPEG library statically or dynamically? Where should I put the library inside the Generic Image Library?
I think that your answer can be found here.
It looks like you don't need to compile libjpeg before boost, but you do need to have it available when building code that uses the jpeg I/O functions.
I ran into the same problem. boost GIL is closely tied to a separate, external library from www.ijg.org (seems like mostly Germans). For Microsoft platforms,
I found there is no installer - you have to compile the source code. And worse
for me, there are some Visual Studio configuration files, but not for v. 8.
So I made my own solution/project from scratch. Don't be alarmed, it's not
so bad. It readily compiles. Briefly, here's how:
[1] download the source code zip file jpegsr9b.zip, from www.ijg.org.
[2] make a simple console-based Visual Studio project ("jconfig") somewhere in the directory where you unpacked the source tree. Add just 1 source code file: ckconfig.c. Compile and run the program. It will make a header file, jconfig.h. Copy or move this file into the main source code directory - there is only 1 directory containing source code in this package.
[3] make another Visual Studio project that will create the library for the JPG package. Configure the project to make a library (I assume you know how), and include the JPG package source code directory in the "Additional Include Directories" configuration parameter.
[4] Include all the source code files (they are all .c files), except the following: rdjpgcom.c, wrjpgcom.c, and jpegtran.c. These files are standalone programs (each with main() -obviously you don't want them in a library).
[5] exclude 2 of the following files (ie, include only 1 of these files): jmemname.c, jmemnobs.c, or jmemansi.c. They contain a different implementations of a "memory manager". I used jmemnobs.c, as the comments indicated it was the simplest implementation, and I just wanted the code to work and was in a hurry. So, in other words, if you did step [4] and included all .c files, now take out 2 of the 3 files listed from your main project file.
[6] build the library. It is completely standalone, so all the files should compile fine.

Working with DLL in a C++ application

I'm planning to use id3lib in my application. I'm looking for a way to use the library as a DLL. I've noticed that they released the library in various form: one of which is windows binary. My target platform in Windows, and I'll use Qt 4.8. After I extract the files in windows binary, I found the following files in Release folder:
id3lib.dll
id3lib.exp
id3lib.lib
I know how to use a DLL in Qt given the DLL, one or more header files where function prototypes resides, and with or without the *.lib file. This package doesn't come with a header file.
How am I supposed to use this package without any header file? What's the purpose of the *.lib and *.exp files here? As far as I know *.lib files are used for static linking with functions which I don't want in my program.
You've just missed the header. It is available under the include subfolder (see here), also the .lib file is still needed for linking, even if you'll be using the DLL.
The usual course is to use a header file #included in the C++ file, the .lib file to link to and the .dll is required at run time.
The header file should/may be in another package as the same header is probably used for different kinds of linking strategies.
At worst you should be able to use a tool such as depends.exe to view the exported symbols and create your own h file to match - but it would be better to find a .h file issued with the release.

Where do I place the MySQL C++ Connector files on Mac?

I am trying to install the MySQL C++ Connector on my Mac. I downloaded the tar.gz file from mysql.com, and when I unzip it, I have three text files, one of which is a Readme that doesn't provide much help. Then there is the /include folder which has two C++ header files and then a sub-folder called /cppconn that has another 14 C++ header file. Then there is also the other folder call /lib that contains a Dynamic Library file and two symbolic links to that Dynamic Library file, as well a a .a file. I was wondering where I place these files or folders on my Mac so that I can write a C++ application that can connect to a database? Or if there is a way for gcc or g++ to be able see these files in a location I specify when compiling? Any help would be much appreciated.
I don't know mac specifics, but usually (in linux / unix / windows - I dont expect mac to be any different) you either
put the header files into some place that is in your compilers header path(such as /usr/include), library files in your compilers lib path (such as /usr/lib),
or
you put them anywhere you like (perhaps /usr/local/my_cpp_connector) and then add that path to your compilers search path, both for headers and libraries.
You could also do like
/usr/local/my_cpp_connector/include
/usr/local/my_cpp_connector/lib
but I guess you got the idea at this point.