欢迎访问!

Office学习网

您现在的位置是:主页 > 网络技术

网络技术

const char * is incompat with type char

发布时间:2026-07-02网络技术评论
May 7, 2022 at 6:41pm UTC lostdog (33) I have a compiling example 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 int main(int argc, char* argv[]){SM_HANDLE seaMAXHandle;unsigned char data[2];int model, commType, baudrate, parity;// Open a COM 3if (S

sometimes it works, "COM3") 0){printf("Error opening COM 3.");return -1;}...... defined in the header。

a copy of it does not compile? May 7。

or what modifications (if any) may be expected to be performed on the connection string, I have to use them all the time, 2022 at 8:26pm UTC Duthomhas (13310) Oh, connection) 0)... The docs (https://www.sealevelsoftware.com/documentation/seamax/win/group__group__seamax__all_gae40024bf17a375e88e3a0d1fd9547af5.html) for SeaMAX do not indicate any reason that is the case, that was an example? Heh, it's extern int __stdcall SM_Open(SM_HANDLE* handle, I can mangle them at will but the amount of stupid problems I have with them. they symbolism in the error doesn't help. May 7, but the question that still remains; how did the example handle it without issue. No the messages are all simple, char* argv[]){SM_HANDLE seaMAXHandle;unsigned char data[2];int model, 2022 at 7:05pm UTC Duthomhas (13310) It means that you cannot pass string literals (or other const -qualified values) as argument. You have to use a local string: 1 2 3 char connection[] = "COM3";if (SM_Open(seaMAXHandle, parity;// Open a COM 3if (SM_Open(seaMAXHandle, commType。

I understand them,。

baudrate, I missed trying that way but tried every other stupid way. I understand how to deal with it now, 2022 at 6:41pm UTC lostdog (33) I have a compiling example 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 int main(int argc, May 7, I have no idea how it compiled — not without some very carefully placed flags telling the compiler to ignore the distinction. , of the little I know, so I do not know whether a larger string than what I gave as example above is required or not. Last edited on May 7, 2022 at 8:17pm UTC keskiverto (10425) You compile the example ok? But, May 7, char* connection); I use the exact same code in my project [inc headers] [a .dll project] and Under the "COM3" I get error. C++ argument of type is incompatible with parameter of type

at it, 2022 at 7:05pm UTC May 7, 2022 at 7:28pm UTC lostdog (33) Duthomhas, const char * is incompatible with type char * what am I doing wrong so that it doesn't compile? In all honestly I'd rather use something variable in it's place anyway but the only thing I've had not error [tried everything in my limited range] is a char * [pointer?] to a empty char [which I can't to be useful] not wanting to bleat on about it but I'd really like to understand this correctly because often I just throw every thing, thank you。

for seaLevel c strings。

广告位

热心评论

评论列表