Comments (5)
Hi. I use gcc/g++ for most of my builds, so it should already work. Can you tell me what warnings you're seeing?
from pdfgen.
Well, this is my test program:
#include "/home/davidoro/libs/PDFGen-master/pdfgen.h"
#include "/home/davidoro/libs/PDFGen-master/pdfgen.c"
int main(int argc, char* argv[]) {
return 0;
}
And this is the output when I run g++ ./main.cpp -o test
In file included from ./main.cpp:3:
/home/davidoro/libs/PDFGen-master/pdfgen.c:101: warning: "_POSIX_SOURCE" redefined
#define _POSIX_SOURCE /* For localtime_r */
In file included from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33,
from /usr/include/stdint.h:26,
from /usr/lib/gcc/x86_64-linux-gnu/8/include/stdint.h:9,
from /home/davidoro/libs/PDFGen-master/pdfgen.h:16,
from ./main.cpp:2:
/usr/include/features.h:264: note: this is the location of the previous definition
# define _POSIX_SOURCE 1
In file included from ./main.cpp:3:
/home/davidoro/libs/PDFGen-master/pdfgen.c:102: warning: "_XOPEN_SOURCE" redefined
#define _XOPEN_SOURCE 600 /* for M_SQRT2 */
In file included from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33,
from /usr/include/stdint.h:26,
from /usr/lib/gcc/x86_64-linux-gnu/8/include/stdint.h:9,
from /home/davidoro/libs/PDFGen-master/pdfgen.h:16,
from ./main.cpp:2:
/usr/include/features.h:203: note: this is the location of the previous definition
# define _XOPEN_SOURCE 700
In file included from ./main.cpp:3:
/home/davidoro/libs/PDFGen-master/pdfgen.c: In function ‘int flexarray_set(flexarray*, int, void*)’:
/home/davidoro/libs/PDFGen-master/pdfgen.c:298:22: error: invalid conversion from ‘void*’ to ‘void***’ [-fpermissive]
flex->bins = bins;
^~~~
/home/davidoro/libs/PDFGen-master/pdfgen.c:300:19: error: invalid conversion from ‘void*’ to ‘void**’ [-fpermissive]
calloc(flexarray_get_bin_size(flex, flex->bin_count - 1),
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sizeof(void *));
~~~~~~~~~~~~~~~
/home/davidoro/libs/PDFGen-master/pdfgen.c: In function ‘ssize_t dstr_ensure(dstr*, size_t)’:
/home/davidoro/libs/PDFGen-master/pdfgen.c:362:27: error: invalid conversion from ‘void*’ to ‘char*’ [-fpermissive]
new_data = realloc(str->data, new_len);
~~~~~~~^~~~~~~~~~~~~~~~~~~~
/home/davidoro/libs/PDFGen-master/pdfgen.c: In function ‘pdf_object* pdf_get_object(const pdf_doc*, int)’:
/home/davidoro/libs/PDFGen-master/pdfgen.c:478:25: error: invalid conversion from ‘void*’ to ‘pdf_object*’ [-fpermissive]
return flexarray_get(&pdf->objects, index);
~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/home/davidoro/libs/PDFGen-master/pdfgen.c: In function ‘pdf_object* pdf_add_object(pdf_doc*, int)’:
/home/davidoro/libs/PDFGen-master/pdfgen.c:525:17: error: invalid conversion from ‘void*’ to ‘pdf_object*’ [-fpermissive]
obj = calloc(1, sizeof(*obj));
~~~~~~^~~~~~~~~~~~~~~~~
/home/davidoro/libs/PDFGen-master/pdfgen.c: In function ‘pdf_doc* pdf_create(float, float, const pdf_info*)’:
/home/davidoro/libs/PDFGen-master/pdfgen.c:576:17: error: invalid conversion from ‘void*’ to ‘pdf_doc*’ [-fpermissive]
pdf = calloc(1, sizeof(*pdf));
~~~~~~^~~~~~~~~~~~~~~~~
/home/davidoro/libs/PDFGen-master/pdfgen.c:591:23: error: invalid conversion from ‘void*’ to ‘pdf_info*’ [-fpermissive]
obj->info = calloc(sizeof(*obj->info), 1);
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
/home/davidoro/libs/PDFGen-master/pdfgen.c: In function ‘int pdf_save_object(pdf_doc*, FILE*, int)’:
/home/davidoro/libs/PDFGen-master/pdfgen.c:805:30: error: invalid conversion from ‘void*’ to ‘pdf_object*’ [-fpermissive]
flexarray_get(&object->pag/e.children, i);
~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/davidoro/libs/PDFGen-master/pdfgen.c:834:30: error: invalid conversion from ‘void*’ to ‘pdf_object*’ [-fpermissive]
f = flexarray_get(&object->bookmark.children, 0);
~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/davidoro/libs/PDFGen-master/pdfgen.c:835:30: error: invalid conversion from ‘void*’ to ‘pdf_object*’ [-fpermissive]
l = flexarray_get(&object->bookmark.children, nchildren - 1);
~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/davidoro/libs/PDFGen-master/pdfgen.c: In function ‘pdf_object* pdf_add_raw_jpeg(pdf_doc*, const char*)’:
/home/davidoro/libs/PDFGen-master/pdfgen.c:2239:23: error: invalid conversion from ‘void*’ to ‘uint8_t*’ {aka ‘unsigned char*’} [-fpermissive]
jpeg_data = malloc(len);
~~~~~~^~~~~
/home/davidoro/libs/PDFGen-master/pdfgen.c: In function ‘int pdf_add_ppm(pdf_doc*, pdf_object*, float, float, float, float, const char*)’:
/home/davidoro/libs/PDFGen-master/pdfgen.c:2339:18: error: invalid conversion from ‘void*’ to ‘uint8_t*’ {aka ‘unsigned char*’} [-fpermissive]
data = malloc(size);
~~~~~~^~~~~~
I'm using gcc version 8.3.0 on Ubuntu 19.04
from pdfgen.
This is caused by compiling the C code as C++. You probably want to use gcc to compile pdfgen.c into pdfgen.o, and then link it against your c++.
However it's not particularly difficult for me to fix up those things that g++ is warning against, so I've done that as well. Either option should work - can I get you to pull the latest code and retry it?
from pdfgen.
I'll leave this issue open until you've had a chance to double check things. Let me know how it works for you now.
from pdfgen.
Hey, just tried out the latest code and the warnings have been removed. Thanks for that! It will be a very usefull library to have.
Cheers!
from pdfgen.
Related Issues (20)
- A HOT 1
- Smart quotes and em dash HOT 8
- 我无法使用密码"abc"打开output.pdf HOT 3
- Macos HOT 5
- Unicode Fonts HOT 18
- Minor gcc warning in pdfgen.c HOT 3
- Generated PDF Comes Broken HOT 5
- The pdf_add_text_wrap method does not work for me HOT 4
- Lua binding HOT 1
- Support hyperlinks
- PDF Error: -22 - PNG has unsupported color type: 6 HOT 1
- Bisotun: A wrapper library around PDFGen HOT 1
- Immediate mode HOT 1
- Add support for UPC barcodes HOT 3
- Issues with adding png image files to pdf HOT 9
- Add support for clib
- MINGW COMPILATION HOT 7
- Add encryption & protection flags support HOT 1
- Adding an image as the entire page HOT 5
- l can't find data_penguin_jpg[] and data_penguin_jpg_len HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pdfgen.