-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
src/AMQPMessage.cpp #72
Comments
你用的什么编译器 |
NULL == '\0' == 0 |
gnu g++ 7.2 on Ubuntu 16.04.
Please see error below:
change the return to NULL or (char*) '\0' will solve the compilation error.
g++ -Wall -I/usr/local/include -L/usr/local/lib -Iinclude/ -c -o
src/AMQP.o src/AMQP.cpp
g++ -Wall -I/usr/local/include -L/usr/local/lib -Iinclude/ -c -o
src/AMQPBase.o src/AMQPBase.cpp
g++ -Wall -I/usr/local/include -L/usr/local/lib -Iinclude/ -c -o
src/AMQPException.o src/AMQPException.cpp
g++ -Wall -I/usr/local/include -L/usr/local/lib -Iinclude/ -c -o
src/AMQPMessage.o src/AMQPMessage.cpp
src/AMQPMessage.cpp: In member function 'char*
AMQPMessage::getMessage(uint32_t*)':
src/AMQPMessage.cpp:48:9: error: invalid conversion from 'char' to 'char*'
[-fpermissive]
return '\0';
^~~~
<builtin>: recipe for target 'src/AMQPMessage.o' failed
make: *** [src/AMQPMessage.o] Error 1
root@be9977d2b8d2:/opt/amqpcpp# g++
g++: fatal error: no input files
compilation terminated.
root@be9977d2b8d2:/opt/amqpcpp# g++
g++: fatal error: no input files
compilation terminated.
root@be9977d2b8d2:/opt/amqpcpp# g++ -h
g++: error: missing argument to '-h'
g++: fatal error: no input files
compilation terminated.
root@be9977d2b8d2:/opt/amqpcpp# g++ --version
g++ (Ubuntu 7.2.0-1ubuntu1~16.04) 7.2.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
…On Mon, Nov 20, 2017 at 7:52 PM, WKR ***@***.***> wrote:
NULL == '\0' == 0
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#72 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AYb9kmiDPMFkeA7iLWGtg9l4PMM0Cufoks5s4kkOgaJpZM4Qk6KF>
.
--
*Chi Ho*
Principal Software Engineer
Roche Sequencing Solution
4155 Hopyard Road Suite 200, Pleasanton, CA 94588
Office: +1 925-730-8820
Mobile: +1 925-998-9329
Fax: +1 925-225-0266
Email: chi.ho@roche.com
|
Sorry,
The cut and paste mess up the error message. Here it is again.
g++ -Wall -I/usr/local/include -L/usr/local/lib -Iinclude/ -c -o
src/AMQP.o src/AMQP.cpp
g++ -Wall -I/usr/local/include -L/usr/local/lib -Iinclude/ -c -o
src/AMQPBase.o src/AMQPBase.cpp
g++ -Wall -I/usr/local/include -L/usr/local/lib -Iinclude/ -c -o
src/AMQPException.o src/AMQPException.cpp
g++ -Wall -I/usr/local/include -L/usr/local/lib -Iinclude/ -c -o
src/AMQPMessage.o src/AMQPMessage.cpp
src/AMQPMessage.cpp: In member function 'char*
AMQPMessage::getMessage(uint32_t*)':
src/AMQPMessage.cpp:48:9: error: invalid conversion from 'char' to 'char*'
[-fpermissive]
return '\0';
^~~~
<builtin>: recipe for target 'src/AMQPMessage.o' failed
make: *** [src/AMQPMessage.o] Error 1
Yes, to your point. Although
NULL == '\0' = 0. However, for type checking compiler, the return type has
to match the signature. That is the reason why I suggest to use the system
definition of "NULL" or type cast the return to "char *"
Chi
…On Mon, Nov 20, 2017 at 7:52 PM, WKR ***@***.***> wrote:
NULL == '\0' == 0
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#72 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AYb9kmiDPMFkeA7iLWGtg9l4PMM0Cufoks5s4kkOgaJpZM4Qk6KF>
.
--
*Chi Ho*
Principal Software Engineer
Roche Sequencing Solution
4155 Hopyard Road Suite 200, Pleasanton, CA 94588
Office: +1 925-730-8820
Mobile: +1 925-998-9329
Fax: +1 925-225-0266
Email: chi.ho@roche.com
|
Different compiler restrictions are not the same. |
Yes, I could modify the code to make it work. However, since I am pulling the git directly from within the Docker Container and do the build within, it would be nice that the fix can be done at the source instead of having a custom script to modify the source. |
你这代码不严谨啊,不能怪人家编译器,一个是char,一个是char* |
I have this same issue on Ubuntu 18.04.2 LTS using g++ (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0 and the following change to line 48 resolved the compilation error:
Thanks |
There is an error during compilation of the file at line 48. The signature of the function is:
char * AMQPMessage::getMessage(uint32_t* length)
On line 48, the return statement is:
return '\0'
which is a char. And it does not agree with the return type.
I would like to suggest to change it to:
return NULL;
or
return (char *) '\0';
The text was updated successfully, but these errors were encountered: