I did not see the answer to this, and I thought the solution was a bit unclear, so I'm going to post how to use protoc.exe for matlab_out
As for the google protocol matlab out protocol, this is using resources from the Internet. I will also include a zip file containing all this already done.
a. In the section " nobase_include_HEADERS = " and below " $(GZHEADERS) "
add the line " farsounder/protobuf/compiler/matlab/matlab_generator.h \ " (note the backslash)
b. In the section " libprotoc_la_LIBADD = $(PTHREAD_LIBS) libprotobuf.la "
add lines
" farsounder/protobuf/compiler/matlab/matlab_generator.cc \ "
" farsounder/protobuf/compiler/matlab/matlab_plugin.cc \ "
from. Save the file and exit it
- While still in the src directory, go to β google β protobuf-> compiler and change main.cc
a. In the section " #include <google/protobuf/compiler/java/java_generator.h> "
add the line " #include <farsounder/protobuf/compiler/matlab/matlab_generator.h> "
b. In the main function, add the lines " // Proto2 Matlab farsounder::protobuf::compiler::matlab::MatlabGenerator matlab_generator; cli.RegisterGenerator("--matlab_out", &matlab_generator, "Generate Matlab M files."); "
from. Save the file and exit it
- Unzip protobuf-matlab
- Open the protobuf-matlab β src file and copy the farsounder directory to the protobuf - # file. #. # β src
- Return to the protobuf - # file. #. # and in β vsprojects and open protobuf.sln in Visual Studio, I believe that any version should work
- A popup window should appear that wants to convert the solution file to a newer version, and do it
- If you do not see explorer explorer open it using ctrl + alt + L
- Open a new Windows Explorer and go to protobuf - #. #. # β src-> farsounder-> protobuf-> compiler-> matlab, now in the visual studio, using the solution explorer, expand libprotoc-> Header Files, now in Windows Explorer copy the matlab_generator.h file and paste it into the header directory.
- Still in the Solutions application, go to the Source Files directory and copy the matlab_generator.cc file
- Contract libprotoc and right click on protoc and click on properties
- In the section "Configuration Properties" β "Binder" β "General", "Edit" Enable incremental binding "No"
- In the section "Configuration Properties" β "Linker-> Input", "Edit Additional Dependencies" a. Add the lines "Release \ libprotobuf.lib" and under "Release \ libprotoc.lib" b. Click OK in the Advanced Dependencies and OK windows on the duct properties page
- Change build type for release
- Right click on libprotobuf and select build, when done right click on libprotoc and select build
- When finished, right-click on protoc and select the assembly, it should provide you protoc.exe under protobuf - #. #. # β vsprojects-> Release, now it will allow you to create matlab.m files by using the matlab_out command
Help find protobuf - #. #. # and protobuf-matlab:
Follow these links:
https://code.google.com/p/protobuf-matlab/source/browse/
download zip file
https://github.com/google/protobuf/releases
download source code
Additional help to use protoc.exe
- Copy and paste the created protoc.exe file to where your .proto file is
- Run cmd and change the directory where the protoc.exe and .proto files are located.
- Run this command (let's pretend my .proto file name is "afunprotofile") "
protoc βmatlab_out=./ -I./ afunprotofile.proto "