cade-vs / vslib

C/C++ toolbox library
GNU General Public License v2.0
3 stars 1 forks source link

compile error #4

Open muetze opened 6 years ago

muetze commented 6 years ago

Hi, (commit 5ea38ceb482c9d22608d91e4d827437d889ff582) build of vslib stops with error:

12:34 vfu joe@eoj> make ~/src/vslib mkdir -p .OBJ.libvslib.a g++ -I. -O2 -c clusters.cpp -o .OBJ.libvslib.a/clusters.o g++ -I. -O2 -c dlog.cpp -o .OBJ.libvslib.a/dlog.o g++ -I. -O2 -c eval.cpp -o .OBJ.libvslib.a/eval.o eval.cpp: In function ‘double Eval(const char)’: eval.cpp:49:14: error: invalid user-defined conversion from ‘VString’ to ‘char’ [-fpermissive] str_copy( p1, exp, ps ); ^~ In file included from eval.cpp:11: ./vstring.h:218:3: note: candidate is: ‘VString::operator const char() const’ operator const char ( ) const { return (const char)box->s; } ^~~~ ./vstring.h:218:3: note: no known conversion from ‘const char’ to ‘char’ In file included from eval.cpp:11: ./vstring.h:345:9: note: initializing argument 1 of ‘char str_copy(char, const char, int, int)’ char str_copy ( char target, const char* source, int pos = 0, int len = -1 ); // returns len' chars frompos' ^~~~ make: *** [makefile:107: .OBJ.libvslib.a/eval.o] Fehler 1

any idea?

cheers, muetze

muetze commented 6 years ago

Sorry, I have formating problems. Didn't mean to strikethrough. Here's another try:

12:34 vfu joe@eoj> make /src/vslib mkdir -p .OBJ.libvslib.a g++ -I. -O2 -c clusters.cpp -o .OBJ.libvslib.a/clusters.o g++ -I. -O2 -c dlog.cpp -o .OBJ.libvslib.a/dlog.o g++ -I. -O2 -c eval.cpp -o .OBJ.libvslib.a/eval.o eval.cpp: In function ‘double Eval(const char)’: eval.cpp:49:14: error: invalid user-defined conversion from ‘VString’ to ‘char’ [-fpermissive] str_copy( p1, exp, ps ); ^ In file included from eval.cpp:11: ./vstring.h:218:3: note: candidate is: ‘VString::operator const char() const’ operator const char ( ) const { return (const char)box->s; } ^~~~ ./vstring.h:218:3: note: no known conversion from ‘const char’ to ‘char’ In file included from eval.cpp:11: ./vstring.h:345:9: note: initializing argument 1 of ‘char str_copy(char, const char, int, int)’ char str_copy ( char target, const char* source, int pos = 0, int len = -1 ); // returns len' chars frompos' ^~~~ make: *** [makefile:107: .OBJ.libvslib.a/eval.o] Fehler 1

cade-vs commented 6 years ago

hello!

there is a difference in default arguments for friend functions between gcc/clang (or older/newer C standard). I fixed this to work with my current gcc and pushed the commit:

commit d6655717f9dac94340120b76c81ca627a13936e7 Author: Vladi Belperchinov-Shabanski cade@bis.bg Date: Mon Sep 17 19:47:42 2018 +0300

backport-of-friend-function-default-args-will-check-cstd-again

please, try again and tell me if this fixes the problem. also, if possible, could you tell me your C++ compiler type and version?

if you have further notes or problems with vslib, feel free to contact me any time! thanks for the message!

cheers, Vladi.

On Sat, 15 Sep 2018 14:53:24 -0700 muetze notifications@github.com wrote:

Hi, (commit 5ea38ceb482c9d22608d91e4d827437d889ff582) build of vslib stops with error:

12:34 vfu joe@eoj> make ~/src/vslib mkdir -p .OBJ.libvslib.a g++ -I. -O2 -c clusters.cpp -o .OBJ.libvslib.a/clusters.o g++ -I. -O2 -c dlog.cpp -o .OBJ.libvslib.a/dlog.o g++ -I. -O2 -c eval.cpp -o .OBJ.libvslib.a/eval.o eval.cpp: In function ‘double Eval(const char)’: eval.cpp:49:14: error: invalid user-defined conversion from ‘VString’ to ‘char’ [-fpermissive] str_copy( p1, exp, ps ); ^~ In file included from eval.cpp:11: ./vstring.h:218:3: note: candidate is: ‘VString::operator const char() const’ operator const char ( ) const { return (const char)box->s; } ^~~~ ./vstring.h:218:3: note: no known conversion from ‘const char’ to ‘char’ In file included from eval.cpp:11: ./vstring.h:345:9: note: initializing argument 1 of ‘char str_copy(char, const char, int, int)’ char str_copy ( char target, const char* source, int pos = 0, int len = -1 ); // returns len' chars frompos' ^~~~ make: *** [makefile:107: .OBJ.libvslib.a/eval.o] Fehler 1

any idea?

cheers, muetze

-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/cade-vs/vslib/issues/4

-- Vladi Belperchinov-Shabanski
cade@bis.bg cade@biscom.net cade@datamax.bg http://cade.datamax.bg pgp/gpg key 6F35B214 @ http://pgp.mit.edu

muetze commented 6 years ago

Thanks, it works now with gcc:

Compiler is gnu (gcc) g++ (Debian 8.2.0-6) 8.2.0 - Debian sid.

Clang version 3.8.1-27 (tags/RELEASE_381/final) is still complaining:

In file included from eval.cpp:11: ./vstring.h:275:19: error: friend declaration specifying a default argument must be a definition friend VString& str_copy ( VString& target, const char* source, int pos = ... ^ ./vstring.h:289:19: error: friend declaration specifying a default argument must be a definition friend VString& str_pad ( VString& target, int len, char ch = ' ' ); ^ ./vstring.h:290:19: error: friend declaration specifying a default argument must be a definition friend VString& str_comma( VString& target, char delim = '\'' ); ^ 3 errors generated.

cade-vs commented 6 years ago

hello again,

yes, actually the previous commit was fine with clang (the last I tested). however it seems that this differs between gcc and clang and I haven't had time to check specs to figure how to fix it for both of them.

I hope gcc has --std which will match clang requirements, but still have to try it (my clang is 3.5.0-10).

May I ask for what do you use vslib/vstring? part of VFU or something else? I'm just curious :)

I'll let you know if I figure this meanwhile.

cheers, Vladi.

On Mon, 17 Sep 2018 15:06:11 -0700 muetze notifications@github.com wrote:

Thanks, it works now with gcc:

Compiler is gnu (gcc) g++ (Debian 8.2.0-6) 8.2.0 - Debian sid.

Clang version 3.8.1-27 (tags/RELEASE_381/final) is still complaining:

In file included from eval.cpp:11: ./vstring.h:275:19: error: friend declaration specifying a default argument must be a definition friend VString& str_copy ( VString& target, const char* source, int pos = ... ^ ./vstring.h:289:19: error: friend declaration specifying a default argument must be a definition friend VString& str_pad ( VString& target, int len, char ch = ' ' ); ^ ./vstring.h:290:19: error: friend declaration specifying a default argument must be a definition friend VString& str_comma( VString& target, char delim = '\'' ); ^ 3 errors generated.

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/cade-vs/vslib/issues/4#issuecomment-422187452

-- Vladi Belperchinov-Shabanski
cade@bis.bg cade@biscom.net cade@datamax.bg http://cade.datamax.bg pgp/gpg key 6F35B214 @ http://pgp.mit.edu

muetze commented 6 years ago

Well, since I'm a vfu user, that is my interest in vslib. I am not a programmer, I just wanted to have you known about that compile flaw. But I realy love vfu! They say emacs is a good operating system, but I'd say: no, its vfu! Speaking of which, I would have some questions and ideas, but I will address them on the vfu repo. Cheers, muetze

cade-vs commented 6 years ago

hi again and thank you!

I'll do my best to keep VFU compilation flawless. I use gcc usually and this problem appeared while I was trying clang. I'll figure how to support both.

You are welcome to send any ideas and questions you have, either in the repo or with private mail.

cheers! Vladi. ps : I do not use emacs either :)))

On Wed, 19 Sep 2018 13:59:37 -0700 muetze notifications@github.com wrote:

Well, since I'm a vfu user, that is my interest in vslib. I am not a programmer, I just wanted to have you known about that compile flaw. But I realy love vfu! They say emacs is a good operating system, but I'd say: no, its vfu! Speaking of which, I would have some questions and ideas, but I will address them on the vfu repo. Cheers, muetze

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/cade-vs/vslib/issues/4#issuecomment-422956554

-- Vladi Belperchinov-Shabanski
cade@bis.bg cade@biscom.net shabanski@gmail.com http://cade.datamax.bg pgp/gpg key 6F35B214 @ http://pgp.mit.edu