Skip to content
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

sketch/Serial_CAN_Module.cpp: In member function 'unsigned char Serial_CAN::exitSettingMode()': #5

Open
yigitbacakoglu opened this issue May 10, 2020 · 4 comments

Comments

@yigitbacakoglu
Copy link

Hi, could you please help me with the error below;

`
Arduino: 1.8.12 (Mac OS X), Board: "Arduino Nano, ATmega328P"

sketch/Serial_CAN_Module.cpp: In member function 'unsigned char Serial_CAN::exitSettingMode()':
sketch/Serial_CAN_Module.cpp:172:31: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
int ret = cmdOk("AT+Q\r\n");
^
sketch/Serial_CAN_Module.cpp: In member function 'unsigned char Serial_CAN::factorySetting()':
sketch/Serial_CAN_Module.cpp:286:26: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
if(cmdOk("AT\r\n"))
^
/Users/yigit/Documents/Arduino/libraries/Serial_CAN_Module/Serial_CAN_Module.cpp: In member function 'unsigned char Serial_CAN::exitSettingMode()':
/Users/yigit/Documents/Arduino/libraries/Serial_CAN_Module/Serial_CAN_Module.cpp:172:31: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
int ret = cmdOk("AT+Q\r\n");
^
/Users/yigit/Documents/Arduino/libraries/Serial_CAN_Module/Serial_CAN_Module.cpp: In member function 'unsigned char Serial_CAN::factorySetting()':
/Users/yigit/Documents/Arduino/libraries/Serial_CAN_Module/Serial_CAN_Module.cpp:286:26: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
if(cmdOk("AT\r\n"))
^
libraries/Serial_CAN_Module/Serial_CAN_Module.cpp.o (symbol from plugin): In function canSerial': (.text+0x0): multiple definition of canSerial'
sketch/Serial_CAN_Module.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/Serial_CAN_Module/Serial_CAN_Module.cpp.o (symbol from plugin): In function canSerial': (.text+0x0): multiple definition of Serial_CAN::begin(int, int, unsigned long)'
sketch/Serial_CAN_Module.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/Serial_CAN_Module/Serial_CAN_Module.cpp.o (symbol from plugin): In function canSerial': (.text+0x0): multiple definition of Serial_CAN::send(unsigned long, unsigned char, unsigned char, unsigned char, unsigned char const*)'
sketch/Serial_CAN_Module.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/Serial_CAN_Module/Serial_CAN_Module.cpp.o (symbol from plugin): In function canSerial': (.text+0x0): multiple definition of Serial_CAN::recv(unsigned long*, unsigned char*)'
sketch/Serial_CAN_Module.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/Serial_CAN_Module/Serial_CAN_Module.cpp.o (symbol from plugin): In function canSerial': (.text+0x0): multiple definition of Serial_CAN::clear()'
sketch/Serial_CAN_Module.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/Serial_CAN_Module/Serial_CAN_Module.cpp.o (symbol from plugin): In function canSerial': (.text+0x0): multiple definition of Serial_CAN::cmdOk(char*)'
sketch/Serial_CAN_Module.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/Serial_CAN_Module/Serial_CAN_Module.cpp.o (symbol from plugin): In function canSerial': (.text+0x0): multiple definition of Serial_CAN::enterSettingMode()'
sketch/Serial_CAN_Module.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/Serial_CAN_Module/Serial_CAN_Module.cpp.o (symbol from plugin): In function canSerial': (.text+0x0): multiple definition of Serial_CAN::exitSettingMode()'
sketch/Serial_CAN_Module.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/Serial_CAN_Module/Serial_CAN_Module.cpp.o (symbol from plugin): In function canSerial': (.text+0x0): multiple definition of Serial_CAN::canRate(unsigned char)'
sketch/Serial_CAN_Module.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/Serial_CAN_Module/Serial_CAN_Module.cpp.o (symbol from plugin): In function canSerial': (.text+0x0): multiple definition of Serial_CAN::baudRate(unsigned char)'
sketch/Serial_CAN_Module.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/Serial_CAN_Module/Serial_CAN_Module.cpp.o (symbol from plugin): In function canSerial': (.text+0x0): multiple definition of make8zerochar(int, char*, unsigned long)'
sketch/Serial_CAN_Module.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/Serial_CAN_Module/Serial_CAN_Module.cpp.o (symbol from plugin): In function canSerial': (.text+0x0): multiple definition of Serial_CAN::setMask(unsigned long*)'
sketch/Serial_CAN_Module.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/Serial_CAN_Module/Serial_CAN_Module.cpp.o (symbol from plugin): In function canSerial': (.text+0x0): multiple definition of Serial_CAN::setFilt(unsigned long*)'
sketch/Serial_CAN_Module.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/Serial_CAN_Module/Serial_CAN_Module.cpp.o (symbol from plugin): In function canSerial': (.text+0x0): multiple definition of Serial_CAN::factorySetting()'
sketch/Serial_CAN_Module.cpp.o (symbol from plugin):(.text+0x0): first defined here
libraries/Serial_CAN_Module/Serial_CAN_Module.cpp.o (symbol from plugin): In function canSerial': (.text+0x0): multiple definition of Serial_CAN::debugMode()'
sketch/Serial_CAN_Module.cpp.o (symbol from plugin):(.text+0x0): first defined here
collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino Nano.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
`

@yigitbacakoglu
Copy link
Author

@stephen1874 can you please have a look at this issue? your help will be appreciated. Thanks

@stephen1874
Copy link
Contributor

Hello @yigitbacakoglu , the error is multiple definition, could you pelase check if you have 2 same library in your folder or somethere else. I just with Arduino 1.8.10, everything is ok.

@yigitbacakoglu
Copy link
Author

yigitbacakoglu commented May 11, 2020

Hello @yigitbacakoglu , the error is multiple definition, could you pelase check if you have 2 same library in your folder or somethere else. I just with Arduino 1.8.10, everything is ok.

Hi Stephen, thanks for quick reply,

Yeap I found this library in the same folder of the .ino file and in the Arduino/libraries folder. and removing one resolved the multiple definition of error but not ISO C++ forbids converting a string constant to error.

So I changed all cmdOk usages from

unsigned char Serial_CAN::exitSettingMode() { clear(); int ret = cmdOk("AT+Q\r\n"); clear(); return ret; }

to

unsigned char Serial_CAN::exitSettingMode() { clear(); int ret = cmdOk((char *)"AT+Q\r\n"); clear(); return ret; }
and it was compiled, does it make any sense?

@stephen1874
Copy link
Contributor

@yigitbacakoglu yes, this make sense, I will modify the code to avoid this wraning as well. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants