aakash-sahai / nanopb

Automatically exported from code.google.com/p/nanopb
zlib License
0 stars 0 forks source link

ANSI C compilation problem #29

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When trying to compile files generated with nanopb-0.1.5 (myFile.pb.c), I get 
error of missing <string> and <cstddef> files included by  
src\google\protobuf\descriptor.pb.h directory.
These are C++ libraries, not available in ANSI-C.

Problem was not existing with nanopb-0.1.1. 
So I guess somewhere between 0.1.1 and 0.1.5 nanopb lost declared ANSI-C 
compliance.

Original issue reported on code.google.com by Adam.Cha...@gmail.com on 25 Aug 2012 at 8:42

GoogleCodeExporter commented 9 years ago
Hmm, this is probably a result of some unnecessary #include that gets generated 
in the .h file, and in turn a consequence of the fix for issue #4.

Can you tell what imports you have in your .proto file? The exclusion list in 
nanopb_generator.py currently has 'nanopb.proto' and 
'google/protobuf/descriptor.proto'.

Original comment by Petteri.Aimonen on 26 Aug 2012 at 6:45

GoogleCodeExporter commented 9 years ago
Thanks for hint. I was able to find out that the problem resides in my build 
tool chain.

The imports that I had in my proto file were:

import "nanopb.proto";
import "descriptor.proto"; // from src/google/protobuf

with additional path to <...>/src/google/protobuf/ dir of google lib.

That resulted in producing additional include in myFile.pb.h:

#include "descriptor.pb.h"

which by unfortune coincidence was during the comoilatiion resolved to 
src/google/protobuf/descriptor.pb.h from google protobuf lib, which is designed 
for C++ compilation....

I corrected my paths settings...
Sorry for not seeing this yesterday. 
For the first look to the symptoms, it suggested to me intentional usage of 
descriptor.pb.h from google code in newer nanopb version.

Original comment by Adam.Cha...@gmail.com on 26 Aug 2012 at 8:14

GoogleCodeExporter commented 9 years ago
.. so - this issue can be freely rejected

Original comment by Adam.Cha...@gmail.com on 26 Aug 2012 at 8:14

GoogleCodeExporter commented 9 years ago
Nice that you got it resolved :)

Original comment by Petteri.Aimonen on 26 Aug 2012 at 8:24