c++报错:invalid conversion from int to int

错误已表明位置,初学求轻喷...
做一个计步软件求每周的步数最大值最小值以及平均值,要求输入多组数据并在最开始输入数据的组数T
#include
#include

using namespace std;
class Step
{
public:
Step(int a[7]);
Step(const Step &c);
~Step(){}
int getMax();
int getMin();
float getAverage();
void showAnswer();
private:
static float Averstep;
int Maxstep,Minstep;
int step[7];
};
Step::Step(int a[7])
{
for(int i=0;i {
step[i]=a[i];
}
}
Step::Step(const Step &c)
{
for(int i=0;i {
step[i]=c.step[i];
}
}
float Step::getAverage()
{
for(int i=0;i Averstep=(Averstep+step[i])/7;
return Averstep;
}
int Step::getMax()
{
int Maxstep=step[0];
for (int i=1;i {
if (step[i]>Maxstep) {
Maxstep=step[i];
}
}
return Maxstep;
}
int Step::getMin()
{
int Minstep=step[0];
for (int i=1;i<=6;i++)
if (step[i] Minstep=step[i];
}
return Minstep;
}
void Step::showAnswer()
{
cout }
float Step::Averstep=0.0;
int main()
{
int T;
int step[7];
cin>>T;
while(cin>>step[0]>>step[1]>>step[2]>>step[3]>>step[4]>>step[5]>>step[6])
{
Step x(step[7]); *****(错误位置)*****
x.showAnswer();
}
return 0;
}


c++

1个回答

step【7】是一个int数,而你的step是0-6的,它越界了
应该传过去一个数组,所以用
Step x(step);

代码里for循环都不完整 我这也调试不了
//*************************

1.实例化的时候只调用了构造函数,没有用他的方法,也就是没有计算最大最小值(可以在计算最大最小的函数里打个断点),我在构造函数里执行了计算的函数所以输出是正常的
2.输入的数据组数没用,这个简单,自己改吧

#include "stdio.h"
#include "iostream"

using namespace std;

class Step
{
public:
    Step(int a[7]);
    Step(const Step &c);
    ~Step(){}
    int getMax();
    int getMin();
    float getAverage();
    void showAnswer();
private:
    static float Averstep;
    int Maxstep, Minstep;
    int step[7];
};
Step::Step(int a[7])
{
    for (int i = 0; i<7; i++) 
    {
        step[i] = a[i];
    }
    Maxstep = getMax();
    Minstep = getMin();
    Averstep = getAverage();
}
Step::Step(const Step &c)
{
    for (int i = 0; i<7; i++)
    {
        step[i] = c.step[i];
    }
}
float Step::getAverage()
{
    for (int i = 0; i<7; i++)
        Averstep = (Averstep + step[i]) / 7;
    return Averstep;
}
int Step::getMax()
{
    int Maxstep = step[0];
    for (int i = 0; i<7; i++)
    {
        if (step[i]>Maxstep) 
        {
            Maxstep = step[i];
        }
    }
    return Maxstep;
}
int Step::getMin()
{
    int Minstep = step[0];
    for (int i = 1; i <= 6; i++)
    {
        if (step[i] < Minstep)
            Minstep = step[i];
    }
return Minstep;
}
void Step::showAnswer()
{
    cout << "max" << Maxstep << endl;
    cout << "min" << Minstep << endl;
    cout << "ave" << Averstep << endl;
}


float Step::Averstep = 0.0;
int main()
{
    int T;
    int step[7];
    cin >> T;
    while (cin >> step[0] >> step[1] >> step[2] >> step[3] >> step[4] >> step[5] >> step[6])
    {
        Step x(step); 

        x.showAnswer();
    }
    system("pause");
    return 0;
}

图片说明

qq_31762199
豆丷 回复Josie0625: 之前不是cin了个T么,用个for循环,输入多组for(int i=0;i<T;i++) cin>>.....
11 个月之前 回复
Josie0625
Josie0625 这个需要多组输入输出的应该怎么修改啊
11 个月之前 回复
Josie0625
Josie0625 回复豆丷: Step::Step(int a[7]) { for(int i=0;i<7;i++) { step[i]=a[i]; } } Step::Step(const Step &c) { for(int i=0;i<7;i++) { step[i]=c.step[i]; } } 不好意思我写的是这样的 复制代码的时候没有粘贴好
11 个月之前 回复
qq_31762199
豆丷 回复Josie0625: Step::Step(int a[7]) { for(int i=0;i { step[i]=a[i]; } } Step::Step(const Step &c) { for(int i=0;i { step[i]=c.step[i]; } } 这里的for循环格式都不会 大括号也对不上
11 个月之前 回复
Josie0625
Josie0625 你好 step的问题我已经修改了 能不能帮助看看for循环哪里不完整 需要怎么改?非常感谢
11 个月之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
c++报错:invalid conversion from int to int

错误已表明位置,初学求轻喷... 做一个计步软件求每周的步数最大值最小值以及平均值,要求输入多组数据并在最开始输入数据的组数T #include <iostream> #include <math.h> using namespace std; class Step { public: Step(int a[7]); Step(const Step &c); ~Step(){} int getMax(); int getMin(); float getAverage(); void showAnswer(); private: static float Averstep; int Maxstep,Minstep; int step[7]; }; Step::Step(int a[7]) { for(int i=0;i<7;i++) { step[i]=a[i]; } } Step::Step(const Step &c) { for(int i=0;i<7;i++) { step[i]=c.step[i]; } } float Step::getAverage() { for(int i=0;i<=6;i++) Averstep=(Averstep+step[i])/7; return Averstep; } int Step::getMax() { int Maxstep=step[0]; for (int i=1;i<=6;i++) { if (step[i]>Maxstep) { Maxstep=step[i]; } } return Maxstep; } int Step::getMin() { int Minstep=step[0]; for (int i=1;i<=6;i++) if (step[i]<Minstep) { Minstep=step[i]; } return Minstep; } void Step::showAnswer() { cout<<Maxstep<<endl<<Minstep<<endl<<floor(Averstep); } float Step::Averstep=0.0; int main() { int T; int step[7]; cin>>T; while(cin>>step[0]>>step[1]>>step[2]>>step[3]>>step[4]>>step[5]>>step[6]) { **_Step x(step[7]);_** *****(错误位置)***** x.showAnswer(); } return 0; } ``` ```

C语言编译时,提示invalid conversion from ‘char’ to ‘char*’ [-fpermissive]错误,请问哪里问题?

编译环境: Armbian(arm嵌入式linux)64位系统,基于Ubuntu Bionic 18.04 LTS 4.19内核 错误提示: ![图片说明](https://img-ask.csdn.net/upload/201902/21/1550707793_4777.png) tools.c:63:13: error: invalid conversion from ‘char’ to ‘char*’ [-fpermissive] *pout = '\0'; ^~~~ 部分代码内容: 这是图片: ![图片说明](https://img-ask.csdn.net/upload/201902/21/1550707811_128009.png) 以下是文字代码: int code_convert(char *from_charset, char *to_charset, char *inbuf, size_t inlen, char *outbuf, size_t outlen) { iconv_t cd; char **pin = &inbuf; char **pout = &outbuf; cd = iconv_open(to_charset, from_charset); if (cd == 0) return -1; memset(outbuf, 0, outlen); if (iconv(cd, pin, &inlen, pout, &outlen) == -1) return -1; iconv_close(cd); *pout = '\0'; return 0; }

c++ 这个报错是什么原因?如何解决?

以下代码在编译时报错: ``` #include<iostream> using namespace std; string type_get, str_empty, str_num1, str_num2; string to_do = "+-*/"; int empty, i, operator_num, num1, num2; int flag = 1;//flag=1:运行,flag=0:退出 int plus(int num1,int num2) { int result; result = num1 + num2; return result; } int minus(int num1,int num2) { int result; result = num1 - num2; return result; } int multiply(int num1,int num2) { int result; result = num1 * num2; return result; } int divide(int num1,int num2) { int result; result = num1 / num2; return result; } int main() { while(flag) { cin >> type_get; if (type_get == "exit") { flag = 0; } else { operator_num = type_get.find_first_of(to_do); char array_type_get[type_get.length()]; for (i = 0; i < type_get.length(); i++) { array_type_get[i] = type_get[i]; } for (i = 0; i < operator_num; i++) { str_num1[i] = array_type_get[i]; } for (i = operator_num + 1; i < sizeof(array_type_get); i++) { str_num2[i] = array_type_get[i]; } num1 = atoi(str_num1.c_str()); num2 = atoi(str_num2.c_str()); switch (array_type_get[operator_num]) { case "+" : plus(num1,num2); break; case "-" : minus(num1,num2); break; case "*" : multiply(num1,num2); break; case "/" : divide(num1,num2); break; default : cout << "请输入一个运算符!" << endl; break; } } } return 0; } ``` 报错信息如下: ``` calculator.cpp: In function 'int main()': calculator.cpp:73:10: error: invalid conversion from 'const char*' to 'int' [-fpermissive] case "+" : ^~~ calculator.cpp:73:10: error: conversion from pointer type 'const char (*)[2]' to arithmetic type 'int' in a constant expression calculator.cpp:74:6: error: reference to 'plus' is ambiguous plus(num1,num2); ^~~~ In file included from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\string:48, from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\bits\locale_classes.h:40, from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\bits\ios_base.h:41, from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\ios:42, from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\ostream:38, from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\iostream:39, from calculator.cpp:1: c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\bits\stl_function.h:147:12: note: candidates are: 'template<class _Tp> struct std::plus' struct plus; ^~~~ calculator.cpp:8:5: note: 'int plus(int, int)' int plus(int num1,int num2) ^~~~ calculator.cpp:77:10: error: invalid conversion from 'const char*' to 'int' [-fpermissive] case "-" : ^~~ calculator.cpp:77:10: error: conversion from pointer type 'const char (*)[2]' to arithmetic type 'int' in a constant expression calculator.cpp:78:6: error: reference to 'minus' is ambiguous minus(num1,num2); ^~~~~ In file included from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\string:48, from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\bits\locale_classes.h:40, from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\bits\ios_base.h:41, from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\ios:42, from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\ostream:38, from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\iostream:39, from calculator.cpp:1: c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\bits\stl_function.h:150:12: note: candidates are: 'template<class _Tp> struct std::minus' struct minus; ^~~~~ calculator.cpp:15:5: note: 'int minus(int, int)' int minus(int num1,int num2) ^~~~~ calculator.cpp:81:10: error: invalid conversion from 'const char*' to 'int' [-fpermissive] case "*" : ^~~ calculator.cpp:81:10: error: conversion from pointer type 'const char (*)[2]' to arithmetic type 'int' in a constant expression calculator.cpp:85:10: error: invalid conversion from 'const char*' to 'int' [-fpermissive] case "/" : ^~~ calculator.cpp:85:10: error: conversion from pointer type 'const char (*)[2]' to arithmetic type 'int' in a constant expression ``` **_在这上面卡了好几天了,求各位大神解答!_**

invalid conversion from 'char**' to 'const char**

``` #include <iostream> using namespace std; int main() { char* a="AAAA"; char* b="BBBB"; char* c="CCCC"; const char*x=a; //二维 char *y[3]= {a,b,c}; const char** z=y; } ``` 最后一行 ``` const char** z=y; ``` 错误,求指教

SDL2 编译报错error: undefined reference to 'openslES_ResumeDevices' 求解决思路

android studio编译SDL2生成.so文件时,报错如下: ``` Build command failed. Error while executing process /Users/ing/sdk/ndk-bundle/ndk-build with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/Android.mk NDK_APPLICATION_MK=/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/Application.mk APP_ABI=x86_64 NDK_ALL_ABIS=x86_64 NDK_DEBUG=1 APP_PLATFORM=android-16 NDK_OUT=/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/build/intermediates/ndkBuild/debug/obj NDK_LIBS_OUT=/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/build/intermediates/ndkBuild/debug/lib /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/build/intermediates/ndkBuild/debug/obj/local/x86_64/libSDL2.so} [x86_64] Compile : SDL2 <= SDL.c [x86_64] Compile : SDL2 <= SDL_assert.c [x86_64] Compile : SDL2 <= SDL_dataqueue.c [x86_64] Compile : SDL2 <= SDL_error.c [x86_64] Compile : SDL2 <= SDL_hints.c [x86_64] Compile : SDL2 <= SDL_log.c [x86_64] Compile : SDL2 <= SDL_audio.c [x86_64] Compile : SDL2 <= SDL_audiocvt.c [x86_64] Compile : SDL2 <= SDL_audiodev.c [x86_64] Compile : SDL2 <= SDL_audiotypecvt.c [x86_64] Compile : SDL2 <= SDL_mixer.c [x86_64] Compile : SDL2 <= SDL_wave.c [x86_64] Compile : SDL2 <= SDL_androidaudio.c [x86_64] Compile : SDL2 <= SDL_dummyaudio.c [x86_64] Compile : SDL2 <= SDL_atomic.c [x86_64] Compile : SDL2 <= SDL_spinlock.c [x86_64] Compile : SDL2 <= SDL_android.c [x86_64] Compile : SDL2 <= SDL_cpuinfo.c [x86_64] Compile : SDL2 <= SDL_dynapi.c [x86_64] Compile : SDL2 <= SDL_clipboardevents.c [x86_64] Compile : SDL2 <= SDL_displayevents.c [x86_64] Compile : SDL2 <= SDL_dropevents.c [x86_64] Compile : SDL2 <= SDL_events.c /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:285:59: warning: format specifies type 'long long' but the argument has type 'SDL_TouchID' (aka 'long') [-Wformat] SDL_EVENT_CASE(SDL_FINGERDOWN) PRINT_FINGER_EVENT(event); break; ~~~~~~~~~~~~~~~~~~~^~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:282:50: note: expanded from macro 'PRINT_FINGER_EVENT' (uint) event->tfinger.timestamp, event->tfinger.touchId, \ ^~~~~~~~~~~~~~~~~~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:285:59: warning: format specifies type 'long long' but the argument has type 'SDL_FingerID' (aka 'long') [-Wformat] SDL_EVENT_CASE(SDL_FINGERDOWN) PRINT_FINGER_EVENT(event); break; ~~~~~~~~~~~~~~~~~~~^~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:283:17: note: expanded from macro 'PRINT_FINGER_EVENT' event->tfinger.fingerId, event->tfinger.x, event->tfinger.y, \ ^~~~~~~~~~~~~~~~~~~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:286:57: warning: format specifies type 'long long' but the argument has type 'SDL_TouchID' (aka 'long') [-Wformat] SDL_EVENT_CASE(SDL_FINGERUP) PRINT_FINGER_EVENT(event); break; ~~~~~~~~~~~~~~~~~~~^~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:282:50: note: expanded from macro 'PRINT_FINGER_EVENT' (uint) event->tfinger.timestamp, event->tfinger.touchId, \ ^~~~~~~~~~~~~~~~~~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:286:57: warning: format specifies type 'long long' but the argument has type 'SDL_FingerID' (aka 'long') [-Wformat] SDL_EVENT_CASE(SDL_FINGERUP) PRINT_FINGER_EVENT(event); break; ~~~~~~~~~~~~~~~~~~~^~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:283:17: note: expanded from macro 'PRINT_FINGER_EVENT' event->tfinger.fingerId, event->tfinger.x, event->tfinger.y, \ ^~~~~~~~~~~~~~~~~~~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:287:61: warning: format specifies type 'long long' but the argument has type 'SDL_TouchID' (aka 'long') [-Wformat] SDL_EVENT_CASE(SDL_FINGERMOTION) PRINT_FINGER_EVENT(event); break; ~~~~~~~~~~~~~~~~~~~^~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:282:50: note: expanded from macro 'PRINT_FINGER_EVENT' (uint) event->tfinger.timestamp, event->tfinger.touchId, \ ^~~~~~~~~~~~~~~~~~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:287:61: warning: format specifies type 'long long' but the argument has type 'SDL_FingerID' (aka 'long') [-Wformat] SDL_EVENT_CASE(SDL_FINGERMOTION) PRINT_FINGER_EVENT(event); break; ~~~~~~~~~~~~~~~~~~~^~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:283:17: note: expanded from macro 'PRINT_FINGER_EVENT' event->tfinger.fingerId, event->tfinger.x, event->tfinger.y, \ ^~~~~~~~~~~~~~~~~~~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:295:62: warning: format specifies type 'long long' but the argument has type 'SDL_TouchID' (aka 'long') [-Wformat] SDL_EVENT_CASE(SDL_DOLLARGESTURE) PRINT_DOLLAR_EVENT(event); break; ~~~~~~~~~~~~~~~~~~~^~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:292:51: note: expanded from macro 'PRINT_DOLLAR_EVENT' (uint) event->dgesture.timestamp, event->dgesture.touchId, \ ^~~~~~~~~~~~~~~~~~~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:295:62: warning: format specifies type 'long long' but the argument has type 'SDL_GestureID' (aka 'long') [-Wformat] SDL_EVENT_CASE(SDL_DOLLARGESTURE) PRINT_DOLLAR_EVENT(event); break; ~~~~~~~~~~~~~~~~~~~^~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:293:17: note: expanded from macro 'PRINT_DOLLAR_EVENT' event->dgesture.gestureId, (uint) event->dgesture.numFingers, \ ^~~~~~~~~~~~~~~~~~~~~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:296:61: warning: format specifies type 'long long' but the argument has type 'SDL_TouchID' (aka 'long') [-Wformat] SDL_EVENT_CASE(SDL_DOLLARRECORD) PRINT_DOLLAR_EVENT(event); break; ~~~~~~~~~~~~~~~~~~~^~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:292:51: note: expanded from macro 'PRINT_DOLLAR_EVENT' (uint) event->dgesture.timestamp, event->dgesture.touchId, \ ^~~~~~~~~~~~~~~~~~~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:296:61: warning: format specifies type 'long long' but the argument has type 'SDL_GestureID' (aka 'long') [-Wformat] SDL_EVENT_CASE(SDL_DOLLARRECORD) PRINT_DOLLAR_EVENT(event); break; ~~~~~~~~~~~~~~~~~~~^~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:293:17: note: expanded from macro 'PRINT_DOLLAR_EVENT' event->dgesture.gestureId, (uint) event->dgesture.numFingers, \ ^~~~~~~~~~~~~~~~~~~~~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/events/SDL_events.c:301:51: warning: format specifies type 'long long' but the argument has type 'SDL_TouchID' (aka 'long') [-Wformat] (uint) event->mgesture.timestamp, event->mgesture.touchId, ^~~~~~~~~~~~~~~~~~~~~~~ 11 warnings generated. [x86_64] Compile : SDL2 <= SDL_gesture.c [x86_64] Compile : SDL2 <= SDL_keyboard.c [x86_64] Compile : SDL2 <= SDL_mouse.c [x86_64] Compile : SDL2 <= SDL_quit.c [x86_64] Compile : SDL2 <= SDL_touch.c [x86_64] Compile : SDL2 <= SDL_windowevents.c [x86_64] Compile : SDL2 <= SDL_rwops.c [x86_64] Compile : SDL2 <= SDL_haptic.c [x86_64] Compile : SDL2 <= SDL_syshaptic.c [x86_64] Compile : SDL2 <= SDL_gamecontroller.c [x86_64] Compile : SDL2 <= SDL_joystick.c [x86_64] Compile : SDL2 <= SDL_sysjoystick.c [x86_64] Compile : SDL2 <= SDL_hidapi_ps4.c [x86_64] Compile : SDL2 <= SDL_hidapi_switch.c [x86_64] Compile : SDL2 <= SDL_hidapi_xbox360.c [x86_64] Compile : SDL2 <= SDL_hidapi_xboxone.c [x86_64] Compile : SDL2 <= SDL_hidapijoystick.c [x86_64] Compile : SDL2 <= SDL_sysloadso.c [x86_64] Compile : SDL2 <= SDL_power.c [x86_64] Compile : SDL2 <= SDL_syspower.c [x86_64] Compile : SDL2 <= SDL_sysfilesystem.c [x86_64] Compile : SDL2 <= SDL_sensor.c [x86_64] Compile : SDL2 <= SDL_androidsensor.c [x86_64] Compile : SDL2 <= SDL_d3dmath.c [x86_64] Compile : SDL2 <= SDL_render.c [x86_64] Compile : SDL2 <= SDL_yuv_sw.c [x86_64] Compile : SDL2 <= SDL_render_d3d.c [x86_64] Compile : SDL2 <= SDL_shaders_d3d.c [x86_64] Compile : SDL2 <= SDL_render_d3d11.c [x86_64] Compile : SDL2 <= SDL_shaders_d3d11.c [x86_64] Compile : SDL2 <= SDL_render_gl.c [x86_64] Compile : SDL2 <= SDL_shaders_gl.c [x86_64] Compile : SDL2 <= SDL_render_gles.c [x86_64] Compile : SDL2 <= SDL_render_gles2.c In file included from /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/render/opengles2/SDL_render_gles2.c:273: /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/render/opengles2/SDL_gles2funcs.h:58:1: warning: incompatible pointer types assigning to 'void (*)(GLuint, GLsizei, const GLchar **, const GLint *)' (aka 'void (*)(unsigned int, int, const char **, const int *)') from 'void (GLuint, GLsizei, const GLchar *const *, const GLint *)' (aka 'void (unsigned int, int, const char *const *, const int *)') [-Wincompatible-pointer-types] SDL_PROC(void, glShaderSource, (GLuint, GLsizei, const GLchar **, const GLint *)) ^ ~~~~~~~~~~~~~~ /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/render/opengles2/SDL_render_gles2.c:262:45: note: expanded from macro 'SDL_PROC' #define SDL_PROC(ret,func,params) data->func=func; ^~~~~ 1 warning generated. [x86_64] Compile : SDL2 <= SDL_shaders_gles2.c [x86_64] Compile : SDL2 <= SDL_render_psp.c [x86_64] Compile : SDL2 <= SDL_blendfillrect.c [x86_64] Compile : SDL2 <= SDL_blendline.c [x86_64] Compile : SDL2 <= SDL_blendpoint.c [x86_64] Compile : SDL2 <= SDL_drawline.c [x86_64] Compile : SDL2 <= SDL_drawpoint.c [x86_64] Compile : SDL2 <= SDL_render_sw.c [x86_64] Compile : SDL2 <= SDL_rotate.c [x86_64] Compile : SDL2 <= SDL_getenv.c [x86_64] Compile : SDL2 <= SDL_iconv.c [x86_64] Compile : SDL2 <= SDL_malloc.c [x86_64] Compile : SDL2 <= SDL_qsort.c [x86_64] Compile : SDL2 <= SDL_stdlib.c [x86_64] Compile : SDL2 <= SDL_string.c [x86_64] Compile : SDL2 <= SDL_thread.c [x86_64] Compile : SDL2 <= SDL_syscond.c [x86_64] Compile : SDL2 <= SDL_sysmutex.c [x86_64] Compile : SDL2 <= SDL_syssem.c [x86_64] Compile : SDL2 <= SDL_systhread.c [x86_64] Compile : SDL2 <= SDL_systls.c [x86_64] Compile : SDL2 <= SDL_timer.c [x86_64] Compile : SDL2 <= SDL_systimer.c [x86_64] Compile : SDL2 <= SDL_RLEaccel.c [x86_64] Compile : SDL2 <= SDL_blit.c [x86_64] Compile : SDL2 <= SDL_blit_0.c [x86_64] Compile : SDL2 <= SDL_blit_1.c [x86_64] Compile : SDL2 <= SDL_blit_A.c [x86_64] Compile : SDL2 <= SDL_blit_N.c [x86_64] Compile : SDL2 <= SDL_blit_auto.c [x86_64] Compile : SDL2 <= SDL_blit_copy.c [x86_64] Compile : SDL2 <= SDL_blit_slow.c [x86_64] Compile : SDL2 <= SDL_bmp.c [x86_64] Compile : SDL2 <= SDL_clipboard.c [x86_64] Compile : SDL2 <= SDL_egl.c [x86_64] Compile : SDL2 <= SDL_fillrect.c [x86_64] Compile : SDL2 <= SDL_pixels.c [x86_64] Compile : SDL2 <= SDL_rect.c [x86_64] Compile : SDL2 <= SDL_shape.c [x86_64] Compile : SDL2 <= SDL_stretch.c [x86_64] Compile : SDL2 <= SDL_surface.c [x86_64] Compile : SDL2 <= SDL_video.c [x86_64] Compile : SDL2 <= SDL_vulkan_utils.c [x86_64] Compile : SDL2 <= SDL_yuv.c [x86_64] Compile : SDL2 <= SDL_androidclipboard.c [x86_64] Compile : SDL2 <= SDL_androidevents.c [x86_64] Compile : SDL2 <= SDL_androidgl.c [x86_64] Compile : SDL2 <= SDL_androidkeyboard.c [x86_64] Compile : SDL2 <= SDL_androidmessagebox.c [x86_64] Compile : SDL2 <= SDL_androidmouse.c [x86_64] Compile : SDL2 <= SDL_androidtouch.c [x86_64] Compile : SDL2 <= SDL_androidvideo.c [x86_64] Compile : SDL2 <= SDL_androidvulkan.c [x86_64] Compile : SDL2 <= SDL_androidwindow.c [x86_64] Compile : SDL2 <= yuv_rgb.c [x86_64] Compile : SDL2 <= SDL_test_assert.c [x86_64] Compile : SDL2 <= SDL_test_common.c [x86_64] Compile : SDL2 <= SDL_test_compare.c [x86_64] Compile : SDL2 <= SDL_test_crc32.c [x86_64] Compile : SDL2 <= SDL_test_font.c [x86_64] Compile : SDL2 <= SDL_test_fuzzer.c [x86_64] Compile : SDL2 <= SDL_test_harness.c [x86_64] Compile : SDL2 <= SDL_test_imageBlit.c [x86_64] Compile : SDL2 <= SDL_test_imageBlitBlend.c [x86_64] Compile : SDL2 <= SDL_test_imageFace.c [x86_64] Compile : SDL2 <= SDL_test_imagePrimitives.c [x86_64] Compile : SDL2 <= SDL_test_imagePrimitivesBlend.c [x86_64] Compile : SDL2 <= SDL_test_log.c [x86_64] Compile : SDL2 <= SDL_test_md5.c [x86_64] Compile : SDL2 <= SDL_test_memory.c [x86_64] Compile : SDL2 <= SDL_test_random.c [x86_64] Compile++ : hidapi <= hid.cpp [x86_64] Prebuilt : libc++_shared.so <= <NDK>/sources/cxx-stl/llvm-libc++/libs/x86_64/ [x86_64] SharedLibrary : libhidapi.so [x86_64] SharedLibrary : libSDL2.so /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/build/intermediates/ndkBuild/debug/obj/local/x86_64/objs-debug/SDL2/src/audio/SDL_audio.o:SDL_audio.c:bootstrap: error: undefined reference to 'openslES_bootstrap' /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/video/android/SDL_androidevents.c:105: error: undefined reference to 'openslES_PauseDevices' /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/video/android/SDL_androidevents.c:112: error: undefined reference to 'openslES_ResumeDevices' /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/video/android/SDL_androidevents.c:156: error: undefined reference to 'openslES_PauseDevices' /Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/src/main/jni/SDL/src/video/android/SDL_androidevents.c:167: error: undefined reference to 'openslES_ResumeDevices' clang++: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [/Users/ing/github/ffmp/SDL2-2.0.10/android-project/app/build/intermediates/ndkBuild/debug/obj/local/x86_64/libSDL2.so] Error 1 ``` 感觉是调用opengl 的相关库时报错,未引用。请教有遇到过此类问题的或者有解决思路的,请不吝赐教。。

Linux下编程遇到的转换错误,要如何修改?

main.cc:118:43: error: invalid conversion from ‘void*’ to ‘_u32* {aka unsigned int*}’ [-fpermissive] cache->addr_list = realloc(cache->addr_list, cache->addr_list_size * sizeof(_u32)); ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ main.cc: In function ‘void reset_cache_sim(cache_sim*, int, int)’: main.cc:179:42: error: invalid conversion from ‘void*’ to ‘_u8* {aka unsigned char*}’ [-fpermissive] cache->cache_buf = malloc(cache->cache_size); ~~~~~~^~~~~~~~~~~~~~~~~~~ main.cc:189:31: error: invalid conversion from ‘void*’ to ‘cache_item*’ [-fpermissive] cache->caches = malloc(sizeof(struct cache_item) * cache->cache_item_num); ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ main.cc: In function ‘void load_trace(cache_sim*, char*)’: main.cc:361:51: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] do_cache_op(cache, (void*)addr, 1); ^~~~ main.cc:364:51: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] do_cache_op(cache, (void*)addr, 0); ^~~~ main.cc: At global scope: main.cc:411:55: error: ISO C++ forbids declaration of ‘do_test’ with no type [-fpermissive] static do_test(struct cache_sim* cache, char* filename) ^ main.cc: In function ‘int main(int, char**)’: main.cc:429:94: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings] st_cases[] = {"gcc.trace","gzip.trace","mcf.trace","swim.trace","twolf.trace"}; ^ main.cc:429:94: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings] main.cc:429:94: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings] main.cc:429:94: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings] main.cc:429:94: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings] 错误描述是这样的,求大神解答

如何连接 std: : string 和 int?

<div class="post-text" itemprop="text"> <p>I thought this would be really simple but it's presenting some difficulties. If I have</p> <pre><code>std::string name = "John"; int age = 21; </code></pre> <p>How do I combine them to get a single string <code>"John21"</code>?</p> </div> <p>转载于:https://stackoverflow.com/questions/191757/how-to-concatenate-a-stdstring-and-an-int</p>

windows上tensorboard无法启动 显示ValueError: Invalid format string

我已经在windows10上安装了tensorflowg的GPU版本,已经按照网上的教程测试完毕了,成功安装上。 但是当我想启动可视化的时候,出现了下列问题。 下图1是网上复制的测试代码。 ![图片说明](https://img-ask.csdn.net/upload/201903/02/1551514606_732628.png) 在annaconda软件中配的tensorflow环境的下已经运行完毕,产生了日志文件并存储与桌面的logs文件夹中。 ![图片说明](https://img-ask.csdn.net/upload/201903/02/1551514729_334182.png) 这时候出现了如下错误: ![图片说明](https://img-ask.csdn.net/upload/201903/02/1551514764_943163.png) 再描述的详细一点吧 ![图片说明](https://img-ask.csdn.net/upload/201903/02/1551524900_605483.png) 也不知道是哪里错了。。 ![图片说明](https://img-ask.csdn.net/upload/201903/02/1551524927_15052.png) 不明白是哪里出的问题,显示的是格式字符无效 也不知道怎么改。。毕竟都是按照网上的教程一步步装的。。已经试了很多种方法,也重装了好几遍就是解决不了。 说明一下:登陆的是实验室的服务器上 是windows server系统的 不知道是不是与这个有关系。 希望有大神可以解决!!跪谢了!!!

关于C语言的指针类型转换问题?

#include <stdio.h> int main() { unsigned int a = 0; unsigned char *p = (char *)&a;//有错 p[0] = 123; p[1] = 111; p[2] = 168; p[3] = 192; printf("%u\n", a); return 0; } 结果报错:error: invalid conversion from 'char*' to 'unsigned char*' [-fpermissive]| 我在想这样为什么不可以转换呢,

Go无法调用C ++函数

<div class="post-text" itemprop="text"> <p>I have been using cgo to interface between Go and C. However, when trying to do the same for Go and C++, I get a compile error every time I attempt to call a function. Using <code>go build .</code> from the code's directory, I get the following errors:</p> <pre><code>./main.go: In function 'void _cgo_3612c872201c_Cfunc_getint(void*)': ./main.go:48:53: error: invalid conversion from 'void*' to '_cgo_3612c872201c_Cfunc_getint(void*)::&lt;anonymous struct&gt;*' [-fpermissive] ./main.go:54:4: error: invalid conversion from 'void*' to '_cgo_3612c872201c_Cfunc_getint(void*)::&lt;anonymous struct&gt;*' [-fpermissive] </code></pre> <p>I've put a super simple example below which shows the problem.</p> <p>main.go:</p> <pre><code>package main /* #cgo CFLAGS: -x c++ int getint() { return 1; } */ import "C" import ( "fmt" ) func main() { fmt.Println(C.getint()) } </code></pre> <p>Does anyone know if this is a bug in cgo, or something wrong with how I wrote the code? According to the <a href="https://golang.org/cmd/cgo/" rel="nofollow noreferrer">cgo documentation</a>, C++ is supported. I'm using Go version 1.7.5 for linux/amd64.</p> <p>Thanks so much!</p> </div>

linux c++ sds库 提示 undefined reference to `sdsempty()'

> 报错: > /tmp/cc3R3ayZ.o: In function 'main' > c.cpp:(.text+0x9): undefined reference to 'sdsempty()' > collect2: error: ld returned 1 exit status** ``` #include <iostream> #include <unistd.h> #include <sds.h> using namespace std; int main(){ sds s= sdsempty(); return 0; } ``` 我更新了sds文件,然后: ``` [root@localhost c4]# g++ -std=c++11 -o test -I/wgs/sds c.cpp In file included from c.cpp:3:0: /wgs/sds/sds.h: In function ‘size_t sdsavail(sds)’: /wgs/sds/sds.h:83:87: error: invalid conversion from ‘void*’ to ‘sdshdr8*’ [-fpermissive] #define SDS_HDR_VAR(T,s) struct sdshdr##T *sh = (void*)((s)-(sizeof(struct sdshdr##T))); ^ /wgs/sds/sds.h:111:13: note: in expansion of macro ‘SDS_HDR_VAR’ SDS_HDR_VAR(8,s); ^ /wgs/sds/sds.h:83:87: error: invalid conversion from ‘void*’ to ‘sdshdr16*’ [-fpermissive] #define SDS_HDR_VAR(T,s) struct sdshdr##T *sh = (void*)((s)-(sizeof(struct sdshdr##T))); ^ /wgs/sds/sds.h:115:13: note: in expansion of macro ‘SDS_HDR_VAR’ SDS_HDR_VAR(16,s); ^ /wgs/sds/sds.h:83:87: error: invalid conversion from ‘void*’ to ‘sdshdr32*’ [-fpermissive] #define SDS_HDR_VAR(T,s) struct sdshdr##T *sh = (void*)((s)-(sizeof(struct sdshdr##T))); ^ /wgs/sds/sds.h:119:13: note: in expansion of macro ‘SDS_HDR_VAR’ SDS_HDR_VAR(32,s); ^ /wgs/sds/sds.h:83:87: error: invalid conversion from ‘void*’ to ‘sdshdr64*’ [-fpermissive] #define SDS_HDR_VAR(T,s) struct sdshdr##T *sh = (void*)((s)-(sizeof(struct sdshdr##T))); ^ /wgs/sds/sds.h:123:13: note: in expansion of macro ‘SDS_HDR_VAR’ SDS_HDR_VAR(64,s); ^ ``` 这个是啥原因啊?

初学c++ 这个求最大值的哪里错了? :)

![图片说明](https://img-ask.csdn.net/upload/201909/29/1569761105_402677.png) 这个求最大值的哪里错了? :)

函数转换时碰到问题,未破,求助各位朋友,非常感谢!!!

**编译时的错误提示:** pmd/pmdEDU.cpp: In function ‘int (* getEntryFuncByType(EDU_TYPES))(pmdEDUCB*, void*)’: pmd/pmdEDU.cpp:94:4: error: invalid conversion from ‘int (*)(pmdEDUCB, void*)’ to ‘pmdEntryPoint {aka int (*)(pmdEDUCB*, void*)}’ [-fpermissive] } ; **其中函数的声明及实现如下:** 头文件中声明: pmdEDU.hpp typedef int (*pmdEntryPoint) ( pmdEDUCB *, void * ) ; pmdEntryPoint getEntryFuncByType ( EDU_TYPES type ) ; int pmdAgentEntryPoint ( pmdEDUCB *cb, void *arg ) ; pmdEDU.cpp文件中实现代码如下: struct _eduEntryInfo { EDU_TYPES type ; int regResult ; pmdEntryPoint entryFunc ; } ; define ON_EDUTYPE_TO_ENTRY1(type,system,entry,desp) \ { type, registerEDUName(type,desp,system), entry } pmdEntryPoint getEntryFuncByType ( EDU_TYPES type ) { pmdEntryPoint rt = NULL ; static const _eduEntryInfo entry[] = { ON_EDUTYPE_TO_ENTRY1 ( EDU_TYPE_AGENT, false, pmdAgentEntryPoint, "Agent" ), ON_EDUTYPE_TO_ENTRY1 ( EDU_TYPE_TCPLISTENER, true, pmdTcpListenerEntryPoint, "TCPListener" ), ON_EDUTYPE_TO_ENTRY1 ( EDU_TYPE_MAXIMUM, false, NULL, "Unknown" ) } ; static const unsigned int number = sizeof ( entry ) / sizeof ( _eduEntryInfo ) ; unsigned int index = 0 ; for ( ; index < number; ++index ) { if ( entry[index].type == type ) { rt = entry[index].entryFunc ; goto done ; } } done : return rt ; } 编译环境:debian sid g++4.8.2 我没发现问题出现在哪儿,烦劳各位了

opencv的 FastFeatureDetector fast(40)怎么用不了

#include <QCoreApplication> #include <opencv2/core/core.hpp> #include <opencv2/features2d/features2d.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/imgproc/imgproc.hpp> using namespace cv; int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); Mat image; image = imread("1.jpg"); // 存储为关键点 std::vector<KeyPoint> keyPoints; // 定义特征检测 FastFeatureDetector fast(40); // 检测的阈值为40 “cv::FastFeatureDetector”: 不能实例化抽象类 // 特征点检测 fast.detect(image,keyPoints); drawKeypoints(image, keyPoints, image, Scalar::all(255), DrawMatchesFlags::DRAW_OVER_OUTIMG); imshow("FAST feature", image); waitKey(0); return a.exec(); } error: C2259: “cv::FastFeatureDetector”: 不能实例化抽象类 error: C2664: “cv::FastFeatureDetector::FastFeatureDetector(cv::FastFeatureDetector &&)”: 无法将参数 1 从“int”转换为“const cv::FastFeatureDetector &”

go运行时无法编译

<div class="post-text" itemprop="text"> <p>I am just wondering why would go runtime fail to build. How do we pass flags (-fpermissive in this case) to the c compiler which golang compiler is using to build the runtime. I am using gcc-4.6.2 on ubuntu 12.04</p> <pre><code>../../../thirdparty/go1.4.2/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/src/runtime/cgo/gcc_linux_amd64.c: In function ‘void _cgo_sys_thread_start(ThreadStart*)’: ../../../thirdparty/go1.4.2/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/src/runtime/cgo/gcc_linux_amd64.c:45:41: error: invalid conversion from ‘void*’ to ‘__sigset_t*’ [-fpermissive] </code></pre> <p>A sample program written also fails to compile, it seems the nil defined in the go code is the problem, i wonder how others are working, when does the golang compiler compiles this runtime code ? </p> <pre><code>gcc t.c -lpthread -o t t.c: In function ‘void* hello_world(void*)’: t.c:12:41: error: invalid conversion from ‘void*’ to ‘__sigset_t*’ [-fpermissive] /usr/include/x86_64-linux-gnu/bits/sigthread.h:31:12: error: initializing argument 3 of ‘int pthread_sigmask(int, const __sigset_t*, __sigset_t*)’ [-fpermissive] rk@rk-VirtualBox:~$ gcc -fpermissive t.c -lpthread -o t t.c: In function ‘void* hello_world(void*)’: t.c:12:41: warning: invalid conversion from ‘void*’ to ‘__sigset_t*’ [-fpermissive] rk@rk-VirtualBox:~$ cat t.c #include&lt;pthread.h&gt; #include&lt;stdio.h&gt; #include&lt;signal.h&gt; #define nil ((void*)0) static void* hello_world(void *vptr) { sigset_t set; sigemptyset(&amp;set); pthread_sigmask(SIG_BLOCK, &amp;set, nil); printf("hello world"); return NULL; } int main(int ac, char **av) { pthread_t t; pthread_create(&amp;t, NULL, hello_world, NULL); pthread_join(t, NULL); return 0; } /usr/include/x86_64-linux-gnu/bits/sigthread.h:31:12: error: initializing argument 3 of ‘int pthread_sigmask(int, const __sigset_t*, __sigset_t*)’ [-fpermissive] make: *** [rulemanager] Error 2 </code></pre> </div>

数组指针的应用??????

#include<stdio.h> int perimeter(int x,int y); int area(int x,int y); int solution(int x,int y,int(*ptr)()); int main() { int a,b; printf(" 请输入A和B的值:"); scanf("%d%d",&a,&b); printf(" Perimeter of a rectangle:"); solution(a,b,perimeter); printf(" Area of a rectangle:"); solution(a,b,area); } int perimeter(int x,int y) { return (2*(x+y)); } int area(int x,int y) { return x*y; } int solution(int x,int y,int(*ptr)()) { int result; result=(*ptr)(x,y); printf("%d\n",result); } [Error] C:\Users\H\Documents\C-Free\Temp\未命名1.cpp:11: error: invalid conversion from `int (*)(int, int)' to `int (*)()'

向函数模板中传入字符串,typeid()和if的搭配会失效,编译不通过,怎么办?

我写了个函数模板里用到了typeid,判断传入变量的类型。传入整型和浮点型都没问题,传入字符串直接编译不通过。 ```C #include <iostream> #include <typeinfo> #include <string> using namespace std; struct Item { int intvalue=0; double doublevalue=0.0; string stringvalue=""; }; template <typename T> void TypeDetect(Item *p, T elem) { if (*typeid(elem).name() == 'i') p->intvalue = elem; else if (*typeid(elem).name() == 'd') p->doublevalue = elem; else if (*typeid(elem).name() == 'P') p->stringvalue = elem; } int main() { Item *p1 = new Item, *p2 = new Item, *p3 = new Item; TypeDetect(p1, 1); TypeDetect(p2, 1.1); TypeDetect(p3, "abc"); cout << p1->intvalue << endl; cout << p2->doublevalue << endl; cout << p3->stringvalue << endl; return 0; } ``` 直接编译上述代码会报错: invalid conversion from 'const char*' to 'int' [-fpermissive] [15, 21] cannot convert 'const char*' to 'double' in assignment [17, 24] 但注释掉 ```C TypeDetect(p3, "abc"); ``` 就可以编译运行了。这是为什么?传入字符串后typeid应该会判断它是一个指针,然后通过if语句判断,但似乎编译器就不认我写的三个if语句。

我可以在cgo中使用c ++吗?

<div class="post-text" itemprop="text"> <p>Is it possible to mix in some C++ code in cgo?</p> <p>I tried this:</p> <pre><code>package main /* #include &lt;iostream&gt; extern "C" void test(const char* str) { std::cout &lt;&lt; str; } */ // #cgo CFLAGS: -x c++ // #cgo LDFLAGS: -lstdc++ import "C" func main() { C.test(C.CString("Testing!!!")) } </code></pre> <p>But I get these errors:</p> <pre><code>error: 'char* CString(_GoString_)' cannot appear in a constant-exp error: 'void test(const char*)' cannot appear in a constant-expres error: invalid conversion from 'char* (*)(_GoString_)' to 'long long int' [-fpermissive] error: invalid conversion from 'void (*)(const char*)' to 'long long int' [-fpermissive] </code></pre> <p>I'm using go1.0.2 and MinGW-w64 4.7.1 </p> </div>

关于返回值为字符,为何显示字符指针

为何报错显示invalid conversion from 'char*' to 'char' [-fpermissive] ?如何更正? ``` char SameGen(fp *p,char name[]) //寻找辈分相同的一代人 { int gen; gen=SearchGen(p,name); //搜索相同的辈分 while(p->lchild!=NULL)当左节点为空时,结束循环 { p=p->lchild; return(p->person.name); } } ```

救救孩子???指针数组

#include<stdio.h> int perimeter(int x,int y); int area(int x,int y); int solution(int x,int y,int(*ptr)()); int main() { int a,b; printf(" 请输入A和B的值:"); scanf("%d%d",&a,&b); printf(" Perimeter of a rectangle:"); solution(a,b,perimeter); printf(" Area of a rectangle:"); solution(a,b,area); } int perimeter(int x,int y) { return (2*(x+y)); } int area(int x,int y) { return x*y; } int solution(int x,int y,int(*ptr)()) { int result; result=(*ptr)(x,y); printf("%d\n",result); } [Error] C:\Users\H\Documents\C-Free\Temp\未命名1.cpp:11: error: invalid conversion from `int (*)(int, int)' to `int (*)()'

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

我以为我学懂了数据结构,直到看了这个导图才发现,我错了

数据结构与算法思维导图

String s = new String(" a ") 到底产生几个对象?

老生常谈的一个梗,到2020了还在争论,你们一天天的,哎哎哎,我不是针对你一个,我是说在座的各位都是人才! 上图红色的这3个箭头,对于通过new产生一个字符串(”宜春”)时,会先去常量池中查找是否已经有了”宜春”对象,如果没有则在常量池中创建一个此字符串对象,然后堆中再创建一个常量池中此”宜春”对象的拷贝对象。 也就是说准确答案是产生了一个或两个对象,如果常量池中原来没有 ”宜春” ,就是两个。...

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

Linux面试题(2020最新版)

文章目录Linux 概述什么是LinuxUnix和Linux有什么区别?什么是 Linux 内核?Linux的基本组件是什么?Linux 的体系结构BASH和DOS之间的基本区别是什么?Linux 开机启动过程?Linux系统缺省的运行级别?Linux 使用的进程间通信方式?Linux 有哪些系统日志文件?Linux系统安装多个桌面环境有帮助吗?什么是交换空间?什么是root帐户什么是LILO?什...

将一个接口响应时间从2s优化到 200ms以内的一个案例

一、背景 在开发联调阶段发现一个接口的响应时间特别长,经常超时,囧… 本文讲讲是如何定位到性能瓶颈以及修改的思路,将该接口从 2 s 左右优化到 200ms 以内 。 二、步骤 2.1 定位 定位性能瓶颈有两个思路,一个是通过工具去监控,一个是通过经验去猜想。 2.1.1 工具监控 就工具而言,推荐使用 arthas ,用到的是 trace 命令 具体安装步骤很简单,大家自行研究。 我的使用步骤是...

学历低,无法胜任工作,大佬告诉你应该怎么做

微信上收到一位读者小涛的留言,大致的意思是自己只有高中学历,经过培训后找到了一份工作,但很难胜任,考虑要不要辞职找一份他能力可以胜任的实习工作。下面是他留言的一部分内容: 二哥,我是 2016 年高中毕业的,考上了大学但没去成,主要是因为当时家里经济条件不太允许。 打工了三年后想学一门技术,就去培训了。培训的学校比较垃圾,现在非常后悔没去正规一点的机构培训。 去年 11 月份来北京找到了一份工...

JVM内存结构和Java内存模型别再傻傻分不清了

JVM内存结构和Java内存模型都是面试的热点问题,名字看感觉都差不多,网上有些博客也都把这两个概念混着用,实际上他们之间差别还是挺大的。 通俗点说,JVM内存结构是与JVM的内部存储结构相关,而Java内存模型是与多线程编程相关,本文针对这两个总是被混用的概念展开讲解。 JVM内存结构 JVM构成 说到JVM内存结构,就不会只是说内存结构的5个分区,而是会延展到整个JVM相关的问题,所以先了解下

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

Google 与微软的浏览器之争

浏览器再现“神仙打架”。整理 | 屠敏头图 | CSDN 下载自东方 IC出品 | CSDN(ID:CSDNnews)从 IE 到 Chrome,再从 Chrome 到 Edge,微软与...

讲一个程序员如何副业月赚三万的真实故事

loonggg读完需要3分钟速读仅需 1 分钟大家好,我是你们的校长。我之前讲过,这年头,只要肯动脑,肯行动,程序员凭借自己的技术,赚钱的方式还是有很多种的。仅仅靠在公司出卖自己的劳动时...

上班一个月,后悔当初着急入职的选择了

最近有个老铁,告诉我说,上班一个月,后悔当初着急入职现在公司了。他之前在美图做手机研发,今年美图那边今年也有一波组织优化调整,他是其中一个,在协商离职后,当时捉急找工作上班,因为有房贷供着,不能没有收入来源。所以匆忙选了一家公司,实际上是一个大型外包公司,主要派遣给其他手机厂商做外包项目。**当时承诺待遇还不错,所以就立马入职去上班了。但是后面入职后,发现薪酬待遇这块并不是HR所说那样,那个HR自...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

搜狗输入法也在挑战国人的智商!

故事总是一个接着一个到来...上周写完《鲁大师已经彻底沦为一款垃圾流氓软件!》这篇文章之后,鲁大师的市场工作人员就找到了我,希望把这篇文章删除掉。经过一番沟通我先把这篇文章从公号中删除了...

85后蒋凡:28岁实现财务自由、34岁成为阿里万亿电商帝国双掌门,他的人生底层逻辑是什么?...

蒋凡是何许人也? 2017年12月27日,在入职4年时间里,蒋凡开挂般坐上了淘宝总裁位置。 为此,时任阿里CEO张勇在任命书中力赞: 蒋凡加入阿里,始终保持创业者的冲劲,有敏锐的...

总结了 150 余个神奇网站,你不来瞅瞅吗?

原博客再更新,可能就没了,之后将持续更新本篇博客。

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

什么时候跳槽,为什么离职,你想好了么?

都是出来打工的,多为自己着想

程序员为什么千万不要瞎努力?

本文作者用对比非常鲜明的两个开发团队的故事,讲解了敏捷开发之道 —— 如果你的团队缺乏统一标准的环境,那么即使勤劳努力,不仅会极其耗时而且成果甚微,使用...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发(16k)

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

终于懂了TCP和UDP协议区别

终于懂了TCP和UDP协议区别

立即提问
相关内容推荐