Correct way to Compile binary_to_compressed.cpp on Linux #3534

Closed
opened 2020-10-15 17:33:49 +00:00 by frink · 1 comment
frink commented 2020-10-15 17:33:49 +00:00 (Migrated from github.com)

In the binary_to_compressed.cpp file it says:

11 // Build with, e.g:
12 //    # cl.exe binary_to_compressed_c.cpp
13 //    # gcc binary_to_compressed_c.cpp

However, this is incorrect. Actually, you need to build with g++ since its a .cpp file. Otherwise, it tries to compile things a .c instead of .cpp, which of course produces errors...

$ gcc binary_to_compressed_c.cpp
/tmp/ccQbimqN.o: In function `binary_to_compressed_c(char const*, char const*, bool, bool)':
binary_to_compressed_c.cpp:(.text+0x299): undefined reference to `operator new[](unsigned long)'
binary_to_compressed_c.cpp:(.text+0x2e9): undefined reference to `operator delete[](void*)'
binary_to_compressed_c.cpp:(.text+0x348): undefined reference to `operator new[](unsigned long)'
binary_to_compressed_c.cpp:(.text+0x680): undefined reference to `operator delete[](void*)'
binary_to_compressed_c.cpp:(.text+0x699): undefined reference to `operator delete[](void*)'
collect2: error: ld returned 1 exit status

The correct way to build with gcc is:

$ g++ binary_to_compressed_c.cpp -o font2c
$ ./font2c
Syntax: ./font2c [-base85] [-nocompress] <inputfile> <symbolname>

You have to specify an output or else it outputs to a.out which is no fun...

Just thought you'd want to know... CHEERS!

In the `binary_to_compressed.cpp` file it says: ``` 11 // Build with, e.g: 12 // # cl.exe binary_to_compressed_c.cpp 13 // # gcc binary_to_compressed_c.cpp ``` However, this is incorrect. Actually, you need to build with g++ since its a .cpp file. Otherwise, it tries to compile things a .c instead of .cpp, which of course produces errors... ``` $ gcc binary_to_compressed_c.cpp /tmp/ccQbimqN.o: In function `binary_to_compressed_c(char const*, char const*, bool, bool)': binary_to_compressed_c.cpp:(.text+0x299): undefined reference to `operator new[](unsigned long)' binary_to_compressed_c.cpp:(.text+0x2e9): undefined reference to `operator delete[](void*)' binary_to_compressed_c.cpp:(.text+0x348): undefined reference to `operator new[](unsigned long)' binary_to_compressed_c.cpp:(.text+0x680): undefined reference to `operator delete[](void*)' binary_to_compressed_c.cpp:(.text+0x699): undefined reference to `operator delete[](void*)' collect2: error: ld returned 1 exit status ``` The correct way to build with `gcc` is: ``` $ g++ binary_to_compressed_c.cpp -o font2c $ ./font2c Syntax: ./font2c [-base85] [-nocompress] <inputfile> <symbolname> ``` You have to specify an output or else it outputs to `a.out` which is no fun... Just thought you'd want to know... CHEERS!
ocornut commented 2020-10-15 17:49:45 +00:00 (Migrated from github.com)

Fixed by 31a144b60c, thank you for reporting!

Fixed by 31a144b60ca41e5cc5a777b91c53610e068538f3, thank you for reporting!
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ocornut/imgui#3534
No description provided.