C++ 编译错误: Error:undefined reference to ` '

我编写了一个从list母类继承的链表linkList子类并把声明写在linkList.h文件中,实现写在linkList.cpp中,
但是我发现只用#include "linkList.h"的话会报错如下图片说明

但是如果加上#include "linkList.cpp" 则不会报错。

希望大神告知错误所在,以及教我一下如何正确的书写头文件和源文件!

以下是代码:

linkList.h:

#ifndef LINKLIST_H_INCLUDED
#define LINKLIST_H_INCLUDED

class OutOfBound {};
class IllegalSize {};

template <class T>
class list
{
public:
    virtual int length() const = 0;
    virtual void clear() = 0;
    virtual void insert(int i,const T& x) = 0;
    virtual void remove(int i) = 0;
    virtual T visit(int i) const = 0;
    virtual int search(const T& x) const = 0;
    virtual void traverse() const = 0;
    virtual ~list() {};
};


template <class T>
class linkList:public list<T>
{
private:
    struct node
    {
            T data;
            node *prev, *next;

            node(const T &x, node* p = NULL, node* n = NULL)
            {
                    data = x;
                    prev = p;
                    next = n;
            }
            node():next(NULL), prev(NULL) {}
            ~node() {}
    };

    node *head, *tail;
    int currentLength;

    node* move(int i) const;

public:
    linkList();
    ~linkList()
    {
            clear();
            delete head;
            delete tail;
    }

    int length() const
    {
            return currentLength;
    }
    void clear();
    void insert(int i,const T& x);
    void remove(int i);
    T visit(int i) const;
    int search(const T& x) const;
    void traverse() const;
};
#endif // LINKLIST_H_INCLUDED


linkList.cpp:
//file:
#include <iostream>
#include <cstdio>
#include "linkList.h"
using namespace std;


template <class T>
typename linkList<T>::node* linkList<T>::move(int i) const
{
    node* p = head -> next;
    if(i < 0 || i > currentLength) throw OutOfBound();
    while(i > 0)
    {
            p = p -> next;
            i--;
    }
    return p;
}

template <class T>
linkList<T>::linkList()
{
    head = new node;
    tail = new node;
    head -> next = tail;
    tail -> prev = head;
    currentLength = 0;
}

template <class T>
void linkList<T>::clear()
{
    node *p, *q;
    p = head -> next;
    while(p != tail)
    {
            q = p -> next;
            delete p;
            p = q;
    }
    head -> next = tail;
    tail -> prev = head;
    currentLength = 0;
}

template <class T>
void linkList<T>::insert(int i, const T& x)
{
    node *pos = move(i);
    node *tmp = new node(x, pos -> prev, pos);
    pos -> prev -> next = tmp;
    pos -> prev = tmp;
    ++currentLength;
}

template <class T>
void linkList<T>::remove(int i)
{
    node *pos = move(i);
    pos -> prev -> next = pos -> next;
    pos -> next -> prev = pos -> prev;
    delete pos;
    --currentLength;
}

template <class T>
int linkList<T>::search(const T& x) const
{
    int i = 0;
    node* p = head -> next;
    while(p != tail && p -> data != x)
    {
            p = p -> next;
            i++;
    }

    if( p == tail)
            return -1;
    else
            return i;
}

template <class T>
T linkList<T>::visit(int i) const
{
    node* p = move(i);
    return p -> data;
}

template <class T>
void linkList<T>::traverse() const
{
    node *p = head -> next;
    while(p != tail)
    {
            cout << p -> data << " ";
            p = p -> next;
    }
    cout << endl;
}

main.cpp:

#include <iostream>
#include "linkList.h"

using namespace std;

int main()
{
    linkList<int> l1;
    int i;
    char ch;
    for(i = 0; i < 100; i++)
    {
            l1.insert(i, i);

    }
    l1.traverse();
    ch = cin.get();
    for(i = 50; i > 0; i--)
    {
            l1.remove(i);

    }
    l1.traverse();
    ch = cin.get();

    cout << l1.length() << endl;
    ch = cin.get();

    for(i = 0; i < l1.length() ; ++i)
    {
            cout << l1.visit(i) << endl;
    }

    l1.traverse();
    ch = cin.get();

    for(i = 60; i < 80 ; ++i)
    {
            cout << l1.search(i) << endl;
    }

    l1.traverse();
    ch = cin.get();

    return 0;
}

5个回答

XZ_GJ
YGJ_SJTU 谢谢!看来类模板和类的实体还是有很大差别,学到了!
大约 2 年之前 回复

关键是两个cpp的编译顺序问题,你的代码本身没问题

codeblock我不是很熟悉,参考:https://blog.csdn.net/i_xiaozhu/article/details/52495292

C++定义模板类的时候,定义和声明必须写在头文件中,不能分开写

模板一般我是这样定义.h .inl inl 文件中加入自己的实现,然后在.h 文件后 加上 #include "xxx.inl"文件。记得模板是是在编译期做了推导。

头文件声明,源文件实现。
编译的时候只对源文件处理,头文件可以很方便的互相引用。
一般来说看头文件能知道这个类有哪些变量、函数。函数具体实现会在源文件中写

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
C++ 编译错误: Error:undefined reference to ` '

我编写了一个从list母类继承的链表linkList子类并把声明写在linkList.h文件中,实现写在linkList.cpp中, 但是我发现只用#include "linkList.h"的话会报错如下![图片说明](https://img-ask.csdn.net/upload/201805/08/1525751289_288763.png) 但是如果加上#include "linkList.cpp" 则不会报错。 希望大神告知错误所在,以及教我一下如何正确的书写头文件和源文件! 以下是代码: linkList.h: #ifndef LINKLIST_H_INCLUDED #define LINKLIST_H_INCLUDED class OutOfBound {}; class IllegalSize {}; template <class T> class list { public: virtual int length() const = 0; virtual void clear() = 0; virtual void insert(int i,const T& x) = 0; virtual void remove(int i) = 0; virtual T visit(int i) const = 0; virtual int search(const T& x) const = 0; virtual void traverse() const = 0; virtual ~list() {}; }; template <class T> class linkList:public list<T> { private: struct node { T data; node *prev, *next; node(const T &x, node* p = NULL, node* n = NULL) { data = x; prev = p; next = n; } node():next(NULL), prev(NULL) {} ~node() {} }; node *head, *tail; int currentLength; node* move(int i) const; public: linkList(); ~linkList() { clear(); delete head; delete tail; } int length() const { return currentLength; } void clear(); void insert(int i,const T& x); void remove(int i); T visit(int i) const; int search(const T& x) const; void traverse() const; }; #endif // LINKLIST_H_INCLUDED linkList.cpp: //file: #include <iostream> #include <cstdio> #include "linkList.h" using namespace std; template <class T> typename linkList<T>::node* linkList<T>::move(int i) const { node* p = head -> next; if(i < 0 || i > currentLength) throw OutOfBound(); while(i > 0) { p = p -> next; i--; } return p; } template <class T> linkList<T>::linkList() { head = new node; tail = new node; head -> next = tail; tail -> prev = head; currentLength = 0; } template <class T> void linkList<T>::clear() { node *p, *q; p = head -> next; while(p != tail) { q = p -> next; delete p; p = q; } head -> next = tail; tail -> prev = head; currentLength = 0; } template <class T> void linkList<T>::insert(int i, const T& x) { node *pos = move(i); node *tmp = new node(x, pos -> prev, pos); pos -> prev -> next = tmp; pos -> prev = tmp; ++currentLength; } template <class T> void linkList<T>::remove(int i) { node *pos = move(i); pos -> prev -> next = pos -> next; pos -> next -> prev = pos -> prev; delete pos; --currentLength; } template <class T> int linkList<T>::search(const T& x) const { int i = 0; node* p = head -> next; while(p != tail && p -> data != x) { p = p -> next; i++; } if( p == tail) return -1; else return i; } template <class T> T linkList<T>::visit(int i) const { node* p = move(i); return p -> data; } template <class T> void linkList<T>::traverse() const { node *p = head -> next; while(p != tail) { cout << p -> data << " "; p = p -> next; } cout << endl; } main.cpp: #include <iostream> #include "linkList.h" using namespace std; int main() { linkList<int> l1; int i; char ch; for(i = 0; i < 100; i++) { l1.insert(i, i); } l1.traverse(); ch = cin.get(); for(i = 50; i > 0; i--) { l1.remove(i); } l1.traverse(); ch = cin.get(); cout << l1.length() << endl; ch = cin.get(); for(i = 0; i < l1.length() ; ++i) { cout << l1.visit(i) << endl; } l1.traverse(); ch = cin.get(); for(i = 60; i < 80 ; ++i) { cout << l1.search(i) << endl; } l1.traverse(); ch = cin.get(); return 0; }

QT中编译时出现的undefined reference to 的问题

我在用QT creator想写一个串口通信程序时,跟很多人一样也是 ```D:\documents\HelloSerialPort\mainwindow.cpp:20: error: undefined reference to SPComm::isOpen() const``` ```D:\documents\HelloSerialPort\debug\mainwindow.o:-1: In function `ZN10MainWindow23on_pushButton_2_clickedEv':``` ```D:\documents\HelloSerialPort\mainwindow.cpp:30: error: undefined reference to `SPComm::isOpen() const'``` 看网上说是在pro文件中添加类所在的目录,可是我怎么知道它是哪个目录呢?完全不懂啊,求教!下面是我的文件 //mainwindow.h ``` #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include "SPComm.h" namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); private slots: void on_pushButton_clicked(); void on_pushButton_2_clicked(); private: Ui::MainWindow *ui; SPComm *m_spcomm; }; #endif // MAINWINDOW_H ``` spcomm.h ``` #ifndef SPCOMM_H #define SPCOMM_H #include <QObject> #include <QtSerialPort/QtSerialPort> class SPComm : public QObject { Q_OBJECT public: explicit SPComm(QObject *parent = 0); ~SPComm(); bool isOpen() const; void setPortName(const QString &name); QString portName() const; void setBaudRate(int baudRate); int baudRate() const; virtual bool open(); virtual void close(); virtual bool clear(); int readData(char *buffer, int count, int timeout = 1000); int writeData(char *data, int size); int write(char ch); protected: QString m_portName; int m_baudRate; QSerialPort *m_serialPort; signals: public slots: }; #endif // SPCOMM_H ```

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 的相关库时报错,未引用。请教有遇到过此类问题的或者有解决思路的,请不吝赐教。。

eclipse编译c源文件编译错误“undefined reference to”,如何解决?

问题描述:在Linux下用eclipse cdt插件开发c,main函数所在的文件引用了其他c文件中的函数,编译结果显示“undefined reference to”,头文件已经包含了。 编译显示结果: make all Making all in src make[1]: Entering directory `/home/wcl/workspace/TieeTerminal/src' gcc -g -O2 -o a.out TieeTerminal.o TieeTerminal.o: In function `get_serialinfo_from_cfgfile': /home/wcl/workspace/TieeTerminal/src/TieeTerminal.c:112: undefined reference to `read_profile_int' make[1]: Leaving directory `/home/wcl/workspace/TieeTerminal/src'。 个人分析:read_profile_int这个函数是在inifile.c中定义,gcc -g -O2 -o a.out TieeTerminal.o 该语句显示链接器没有链接inifile.o,但是怎么在eclipse里设置呢?

android +opencv问题 大神速进!

目的是要在android app中不用到opencv manager; 但是用cygwin编译时碰到问题(好几页错误,都是这一类型的) E:/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/../l ib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: . /obj/local/armeabi-v7a/objs/ProcessImg/Cartoon.o: in function image_proc(cv::Mat ):jni/Cartoon.cpp:32: error: undefined reference to 'cv::threshold(cv::_InputArr ay const&, cv::_OutputArray const&, double, double, int)' E:/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/../l ib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: . /obj/local/armeabi-v7a/objs/ProcessImg/Cartoon.o: in function image_proc(cv::Mat ):jni/Cartoon.cpp:34: error: undefined reference to 'cv::_InputArray::_InputArra y(cv::Mat const&)' E:/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/../l ib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: . /obj/local/armeabi-v7a/objs/ProcessImg/Cartoon.o: in function image_proc(cv::Mat ):jni/Cartoon.cpp:34: error: undefined reference to 'cv::resize(cv::_InputArray const&, cv::_OutputArray const&, cv::Size_<int>, double, double, int)' E:/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/../l ib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: . /obj/local/armeabi-v7a/objs/ProcessImg/Cartoon.o: in function image_proc(cv::Mat ):jni/Cartoon.cpp:40: error: undefined reference to 'cv::bilateralFilter(cv::_In putArray const&, cv::_OutputArray const&, int, double, double, int)' E:/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/../l ib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: . /obj/local/armeabi-v7a/objs/ProcessImg/Cartoon.o: in function image_proc(cv::Mat ):jni/Cartoon.cpp:41: error: undefined reference to 'cv::bilateralFilter(cv::_In putArray const&, cv::_OutputArray const&, int, double, double, int)' E:/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/../l ib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: . /obj/local/armeabi-v7a/objs/ProcessImg/Cartoon.o: in function image_proc(cv::Mat ):jni/Cartoon.cpp:44: error: undefined reference to 'cv::resize(cv::_InputArray const&, cv::_OutputArray const&, cv::Size_<int>, double, double, int)' E:/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/../l ib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: . /obj/local/armeabi-v7a/objs/ProcessImg/Cartoon.o: in function image_proc(cv::Mat ):jni/Cartoon.cpp:46: error: undefined reference to 'cv::_InputArray::_InputArra y(double const&)' E:/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/../l ib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: . /obj/local/armeabi-v7a/objs/ProcessImg/Cartoon.o: in function image_proc(cv::Mat ):jni/opencv2/core/core.hpp:1778: error: undefined reference to 'cv::noArray()' E:/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/../l ib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: . /obj/local/armeabi-v7a/objs/ProcessImg/Cartoon.o: in function image_proc(cv::Mat ):jni/Cartoon.cpp:46: error: undefined reference to 'cv::Mat::setTo(cv::_InputAr ray const&, cv::_InputArray const&)' E:/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/../l ib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: . /obj/local/armeabi-v7a/objs/ProcessImg/Cartoon.o: in function image_proc(cv::Mat ):jni/Cartoon.cpp:49: error: undefined reference to 'cv::Mat::copyTo(cv::_Output Array const&, cv::_InputArray const&) const' E:/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/../l ib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: . /obj/local/armeabi-v7a/objs/ProcessImg/ImageProc.o: in function cv::Mat::Mat(cv: :Mat const&):jni/opencv2/core/mat.hpp:125: error: undefined reference to 'cv::Ma t::copySize(cv::Mat const&)' E:/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/../l ib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: . /obj/local/armeabi-v7a/objs/ProcessImg/ImageProc.o: in function Java_com_example _cartoonfiy_ImageProc_CartoonProc:jni/ImageProc.cpp:20: error: undefined referen ce to 'cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)' E:/android-ndk-r9/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/../l ib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: . /obj/local/armeabi-v7a/objs/ProcessImg/ImageProc.o: in function Java_com_example _cartoonfiy_ImageProc_CartoonProc:jni/ImageProc.cpp:23: error: undefined referen ce to 'cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)' collect2: ld returned 1 exit status make: *** [obj/local/armeabi-v7a/libProcessImg.so] Error 1 以下是android.mk代码: LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) OpenCV_INSTALL_MODULES:=on OPENCV_CAMERA_MODULES:=off OPENCV_LIB_TYPE:=STATIC ifeq ("$(wildcard $(OPENCV_MK_PATH))","%") include E:\OpenCV-2.4.10-android-sdk\sdk\native\jni\OpenCV.mk else include $(OPENCV_MK_PATH) endif LOCAL_MODULE := ProcessImg LOCAL_SRC_FILES :=Cartoon.cpp\ ImageProc.cpp LOCAL_LDLIBS += -lm -llog include $(BUILD_SHARED_LIBRARY)

线程emit send(int)提示 error: undefined reference to `MyThread::send(int)'

若定义void MyThread::send(int) { } 编译时提示No such signal QThread::send(int) QThread类头文件 ``` #ifndef MYTHREAD_H #define MYTHREAD_H #include <QThread> class MyThread : public QThread { signals: void send(int); public: MyThread(); protected: void run(); }; #endif // MYTHREAD_H ``` QThread .cpp文件 ``` #include "mythread.h" MyThread::MyThread() { } void MyThread::run() { int i = 9; emit send(i); } void MyThread::send(int) { } ``` 连接线程信号和主线程的槽函数 ``` #include "widget.h" #include "ui_widget.h" Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget) { ui->setupUi(this); m_thread = new MyThread; connect(m_thread,SIGNAL(send(int)),this,SLOT(UpdateSlot())); } ```

wpa_supplicant编译时出现 undefined reference to `sha256_vector'

CC ../src/drivers/drivers.c CC ../src/l2_packet/l2_packet_linux.c ../src/wps/wps_common.o: In function `wps_derive_keys': /home/atheros/Atheros-P2P/wpa_supplicant-2.1/wpa_supplicant/../src/wps/wps_common.c:101: undefined reference to `sha256_vector' ../src/wps/wps_enrollee.o: In function `wps_process_pubkey': /home/atheros/Atheros-P2P/wpa_supplicant-2.1/wpa_supplicant/../src/wps/wps_enrollee.c:519: undefined reference to `sha256_vector' ../src/crypto/tls_openssl.o: In function `openssl_tls_cert_event': /home/atheros/Atheros-P2P/wpa_supplicant-2.1/wpa_supplicant/../src/crypto/tls_openssl.c:1346: undefined reference to `sha256_vector' ../src/crypto/tls_openssl.o: In function `tls_verify_cb': /home/atheros/Atheros-P2P/wpa_supplicant-2.1/wpa_supplicant/../src/crypto/tls_openssl.c:1421: undefined reference to `sha256_vector' ../src/crypto/crypto_openssl.o: In function `crypto_hash_init': /home/atheros/Atheros-P2P/wpa_supplicant-2.1/wpa_supplicant/../src/crypto/crypto_openssl.c:620: undefined reference to `EVP_sha256' ../src/crypto/crypto_openssl.o: In function `hmac_sha256_vector': /home/atheros/Atheros-P2P/wpa_supplicant-2.1/wpa_supplicant/../src/crypto/crypto_openssl.c:754: undefined reference to `EVP_sha256' collect2: error: ld returned 1 exit status make: *** [wpa_supplicant] Error 1 root@atheros:/home/atheros/Atheros-P2P/wpa_supplicant-2.1/wpa_supplicant#

g++ undefined reference to 'std::cin'

![图片说明](https://img-ask.csdn.net/upload/201603/06/1457253528_973262.png) ![图片说明](https://img-ask.csdn.net/upload/201603/06/1457253544_748133.png) ![图片说明](https://img-ask.csdn.net/upload/201603/06/1457253580_553821.png) 用了g++,用了-lstdc++,直接写std::cin 都没有用

opencv 在as ndk中 始终抱找不到 undefined reference to 'cv::imwrite

就这几行简单的代码编译都不通过 ``` #include"opencv2/opencv.hpp" using namespace cv; int sss() { Mat image= imread( "1", CV_LOAD_IMAGE_COLOR); imwrite("2.bmp",image); return 1; } ``` CMakeLists 文件 ``` cmake_minimum_required(VERSION 3.4.1) add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0) set(CMAKE_VERBOSE_MAKEFILE on) set(ocvlibs "C:\\BC\\OpenCV\\sdk\\native\\libs") # 设置include文件夹的地址 include_directories(C:/BC/lua-5.2.0/src) include_directories(C:\\BC\\OpenCV\\sdk\\native\\jni\\include) add_library(native-lib SHARED native-lib.cpp) # 设置opencv的动态库 add_library(libopencv_java SHARED IMPORTED ) set_target_properties(libopencv_java PROPERTIES IMPORTED_LOCATION "${ocvlibs}/${ANDROID_ABI}/libopencv_java3.so") find_library(log-lib log) target_link_libraries(native-lib android log libopencv_java ${log-lib} ) ``` build.gradle ``` apply plugin: 'com.android.application' android { compileSdkVersion 28 defaultConfig { applicationId "com.example.opencvtest" minSdkVersion 22 targetSdkVersion 28 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" externalNativeBuild { cmake { cppFlags "-std=c++11", "-frtti", "-fexceptions" abiFilters 'x86' } } } sourceSets{ main{ jniLibs.srcDirs = ['C:\\BC\\OpenCV\\sdk\\native\\libs'] } } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } externalNativeBuild { cmake { path "src/main/cpp/CMakeLists.txt" version "3.10.2" } } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.android.support:appcompat-v7:28.0.0' implementation 'com.android.support.constraint:constraint-layout:1.1.3' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' } ``` ![图片说明](https://img-ask.csdn.net/upload/201906/03/1559539210_344978.png)

c连接mysql数据库:undefined reference to `mysql_init@4'

环境特殊,使用一个组态软件自带的ceditor编辑器编辑c连接数据库,wing编译,结果报错。(是找不到lib文件吗?把这个lib文件放到编译器的lib文件中中可以吗?还是怎么操作?求指教,有报酬)提示如下: C:\Users\FeiMao\AppData\Local\Temp\cc1PfS40.o:main.c:(.text+0x81): undefined reference to `mysql_init@4' C:\Users\FeiMao\AppData\Local\Temp\cc1PfS40.o:main.c:(.text+0xc6): undefined reference to `mysql_real_connect@32' C:\Users\FeiMao\AppData\Local\Temp\cc1PfS40.o:main.c:(.text+0xec): undefined reference to `mysql_query@8' C:\Users\FeiMao\AppData\Local\Temp\cc1PfS40.o:main.c:(.text+0xfd): undefined reference to `mysql_close@4' C:\Users\FeiMao\AppData\Local\Temp\cc1PfS40.o:main.c:(.text+0x10d): undefined reference to `mysql_error@4' collect2: ld returned 1 exit status

编译安卓4.4出错如下,求解!

各位大虾,编译安卓4.4 根文件系统,报错如下, 很多网友的帖子说是swap分区空间不够,我也增大了swap分区,并且在编译时监控内存使用率,并没有达到100% 代码肯定没问题,在其他地方都编译成功了,提示一大堆的undefined ,不知道为什么 有哪位知道如何处理,请指教,谢谢! external/chromium_org/third_party/WebKit/Source/core/platform/sql/SQLiteDatabase.cpp:343: error: undefined reference to 'sqlite3_errcode' external/chromium_org/third_party/WebKit/Source/core/platform/sql/SQLiteDatabase.cpp:349: error: undefined reference to 'sqlite3_errmsg' external/chromium_org/third_party/WebKit/Source/core/platform/sql/SQLiteDatabase.cpp:461: error: undefined reference to 'sqlite3_set_authorizer' external/chromium_org/third_party/WebKit/Source/core/platform/sql/SQLiteDatabase.cpp:466: error: undefined reference to 'sqlite3_get_autocommit' external/chromium_org/third_party/WebKit/Source/core/platform/sql/SQLiteDatabase.cpp:129: error: undefined reference to 'sqlite3_interrupt' external/chromium_org/third_party/WebKit/Source/core/platform/sql/SQLiteDatabase.cpp:114: error: undefined reference to 'sqlite3_close' external/chromium_org/third_party/WebKit/Source/core/platform/sql/SQLiteDatabase.cpp:76: error: undefined reference to 'sqlite3_errmsg' external/chromium_org/third_party/WebKit/Source/core/platform/sql/SQLiteDatabase.cpp:79: error: undefined reference to 'sqlite3_close' external/chromium_org/third_party/WebKit/Source/core/platform/sql/SQLiteDatabase.cpp:84: error: undefined reference to 'sqlite3_extended_result_codes' external/chromium_org/third_party/WebKit/Source/core/platform/sql/SQLiteDatabase.cpp:86: error: undefined reference to 'sqlite3_errmsg' external/chromium_org/third_party/WebKit/Source/core/platform/sql/SQLiteDatabase.cpp:88: error: undefined reference to 'sqlite3_close' external/chromium_org/third_party/WebKit/Source/core/platform/sql/SQLiteStatement.cpp:75: error: undefined reference to 'sqlite3_prepare_v2' external/chromium_org/third_party/WebKit/Source/core/platform/sql/SQLiteStatement.cpp:104: error: undefined reference to 'sqlite3_step' external/chromium_org/third_party/WebKit/Source/core/platform/sql/SQLiteStatement.cpp:121: error: undefined reference to 'sqlite3_finalize' external/chromium_org/third_party/WebKit/Source/core/platform/sql/SQLiteStatement.cpp:218: error: undefined reference to 'sqlite3_bind_double' external/chromium_org/third_party/WebKit/Source/core/platform/sql/SQLiteStatement.cpp:227: error: undefined reference to 'sqlite3_bind_null' external/chromium_org/third_party/WebKit/Source/core/platform/sql/SQLiteStatement.cpp:250: error: undefined reference to 'sqlite3_bind_parameter_count' external/chromium_org/third_party/WebKit/Source/core/platform/sql/SQLiteStatement.cpp:258: error: undefined reference to 'sqlite3_data_count' external/chromium_org/third_party/WebKit/Source/core/platform/sql/SQLiteStatement.cpp:292: error: undefined reference to 'sqlite3_column_name16' external/chromium_org/third_party/WebKit/Source/core/platform/sql/SQLiteStatement.cpp:306: error: undefined reference to 'sqlite3_column_value' external/chromium_org/third_party/WebKit/Source/core/platform/sql/SQLiteStatement.cpp:307: error: undefined reference to 'sqlite3_value_type' external/chromium_org/third_party/WebKit/Source/core/platform/sql/SQLiteStatement.cpp:310: error: undefined reference to 'sqlite3_value_double' external/chromium_org/third_party/WebKit/Source/core/platform/sql/SQLiteStatement.cpp:313: error: undefined reference to 'sqlite3_value_text16' external/chromium_org/third_party/WebKit/Source/core/platform/sql/SQLiteStatement.cpp:334: error: undefined reference to 'sqlite3_column_text16' external/chromium_org/third_party/WebKit/Source/core/platform/sql/SQLiteStatement.cpp:335: error: undefined reference to 'sqlite3_column_bytes16' external/chromium_org/third_party/WebKit/Source/core/platform/sql/SQLiteStatement.cpp:357: error: undefined reference to 'sqlite3_column_int' external/chromium_org/third_party/WebKit/Source/core/platform/sql/SQLiteStatement.cpp:368: error: undefined reference to 'sqlite3_column_int64' external/chromium_org/third_party/WebKit/Source/core/platform/sql/SQLiteStatement.cpp:191: error: undefined reference to 'sqlite3_bind_text16' external/chromium_org/third_party/WebKit/Source/core/platform/sql/chromium/SQLiteFileSystemChromium.cpp:49: error: undefined reference to 'sqlite3_open' external/chromium_org/third_party/WebKit/Source/core/platform/sql/chromium/SQLiteFileSystemChromium.cpp:51: error: undefined reference to 'sqlite3_open_v2' external/chromium_org/third_party/WebKit/Source/core/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp:150: error: undefined reference to 'sqlite3_snprintf' external/chromium_org/third_party/WebKit/Source/core/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp:65: error: undefined reference to 'chromium_sqlite3_initialize_unix_sqlite3_file' external/chromium_org/third_party/WebKit/Source/core/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp:67: error: undefined reference to 'chromium_sqlite3_get_reusable_file_handle' external/chromium_org/third_party/WebKit/Source/core/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp:79: error: undefined reference to 'chromium_sqlite3_destroy_reusable_file_handle' external/chromium_org/third_party/WebKit/Source/core/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp:85: error: undefined reference to 'chromium_sqlite3_update_reusable_file_handle' external/chromium_org/third_party/WebKit/Source/core/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp:92: error: undefined reference to 'chromium_sqlite3_fill_in_unix_sqlite3_file' external/chromium_org/third_party/WebKit/Source/core/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp:94: error: undefined reference to 'chromium_sqlite3_destroy_reusable_file_handle' external/chromium_org/third_party/WebKit/Source/core/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp:173: error: undefined reference to 'sqlite3_vfs_find' external/chromium_org/third_party/WebKit/Source/core/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp:194: error: undefined reference to 'sqlite3_vfs_register' external/chromium_org/webkit/glue/webkit_glue.cc:14: error: undefined reference to 'v8::V8::SetFlagsFromString(char const*, int)' external/chromium_org/webkit/child/webkit_child_helpers.cc:29: error: undefined reference to 'v8::HeapStatistics::HeapStatistics()' ****external/chromium_org/webkit/child/webkit_child_helpers.cc:32: error: undefined reference to 'v8::Isolate::GetHeapStatistics(v8::HeapStatistics*)' collect2: error: ld returned 1 exit status make: *** [out/target/product/drone2/obj/SHARED_LIBRARIES/libwebviewchromium_intermediates/LINKED/libwebviewchromium.so] Error 1 ****

c++ 编译时报错 "undefined reference to ……"

![编译情况](https://img-ask.csdn.net/upload/201803/17/1521251236_172399.png) 总共有五个文件,Graph.h ,Graph.cpp,diamond.h.diamond.cpp,new.cpp 编译成功的是我把diamond类的声明和定义(Graph的声明和定义也放在了一个文件里,但是没有影响)都放在diamond.cpp里。 new.cpp 就是包含了"Graph.h"和"diamond.",然后用diamond创建了一个对象,调用ShapePrint()函数。 Graph.h ``` #ifndef _Graph_H_ #define _Graph_H_ class shape { public: void ShapePrint(); void ShapePrint(int x); void ShapePrint(int x,int y); int GetLength_x(); int GetLength_y(); protected: void SetLength_x(int length_x); void SetLength_y(int length_y); private: int length_x ; int length_y ; }; #endif ``` diamond.h ``` #include <iostream> #include <iomanip> #include "Graph.h" #ifndef _diamond_ #define _diamond_ class diamond:public shape{ public: diamond(); diamond(int x); int GetLength(); protected: void SetLength(int l); private: int length; }; #endif ``` diamond.cpp ``` #include "diamond.h" using namespace std; void diamond::SetLength(int l) { this->length = l; } int diamond::GetLength() { return length; } diamond::diamond() { SetLength(7); } diamond::diamond(int l) { SetLength(l); } void diamond::ShapePrint() { int length=GetLength(); for(int i=1;i<=length;++i) { cout<<setw(length-i+1)<<"*"; if(i!=1) cout<<setw(2*i-2)<<"*"<<endl; else cout<<endl; } for(int k=1;k<=length-1;k++) { cout<<setw(k+1)<<"*"; if(k==length-1) cout<<endl; else cout<<setw(2*(length-k)-2)<<"*"<<endl; } } void diamond::ShapePrint(int x) { int length=GetLength(); for(int i=1;i<=length;++i) { cout<<setw(x+(length-i+1))<<"*"; if(i!=1) cout<<setw(2*i-2)<<"*"<<endl; else cout<<endl; } for(int k=1;k<=length-1;k++) { cout<<setw(x+k+1)<<"*"; if(k==length-1) cout<<endl; else cout<<setw(2*(length-k)-2)<<"*"<<endl; } } void diamond::ShapePrint(int x,int y) { int length=GetLength(); for(int i=1;i<=y;i++) cout<<endl; for(int i=1;i<=length;++i) { cout<<setw(x+(length-i+1))<<"*"; if(i!=1) cout<<setw(2*i-2)<<"*"<<endl; else cout<<endl; } for(int k=1;k<=length-1;k++) { cout<<setw(x+k+1)<<"*"; if(k==length-1) cout<<endl; else cout<<setw(2*(length-k)-2)<<"*"<<endl; } } ```

OpenGL代码编译时出现undefined reference to `XineramaQueryExtension'是什么原因?如何解决?

我的c++程序使用了glfw和glad,编译环境中这两个都有,但编译时报如下错,如何解决? **报错信息:** ``` //tmp/cco8XNYv.o: In function `main': test2.cpp:(.text+0xdd): undefined reference to `gladLoadGLLoader' /tmp/cco8XNYv.o: In function `framebuffer_size_callback(GLFWwindow*, int, int)': test2.cpp:(.text+0x192): undefined reference to `glad_glViewport' /usr/local/lib/libglfw3.a(x11_init.c.o): In function `initExtensions': x11_init.c:(.text+0x1b05): undefined reference to `XineramaQueryExtension' x11_init.c:(.text+0x1b1d): undefined reference to `XineramaIsActive' /usr/local/lib/libglfw3.a(x11_init.c.o): In function `_glfwCreateCursorX11': x11_init.c:(.text+0x23ea): undefined reference to `XcursorImageCreate' x11_init.c:(.text+0x2507): undefined reference to `XcursorImageLoadCursor' x11_init.c:(.text+0x2515): undefined reference to `XcursorImageDestroy' /usr/local/lib/libglfw3.a(x11_monitor.c.o): In function `_glfwPlatformGetMonitors': x11_monitor.c:(.text+0x682): undefined reference to `XineramaQueryScreens' collect2: ld returned 1 exit status ``` **编译命令:** ``` g++ test.cpp -o test -lglfw3 -lGL -lX11 -lpthread -lXrandr -lXi ``` **代码:** ``` #include<glad/glad.h> #include<GLFW/glfw3.h> #include<iostream> using namespace std; void framebuffer_size_callback(GLFWwindow* window, int width, int height); int main() { glfwInit(); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); GLFWwindow* window = glfwCreateWindow(800, 600, "fly's window", NULL, NULL); if(window == NULL) { cout << "Failed to create GLFW window" << endl; glfwTerminate(); return -1; } glfwMakeContextCurrent(window); glfwSetFramebufferSizeCallback(window, framebuffer_size_callback); if(!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) { cout << "Failed to initialize GLAD" << endl; return -1; } while(!glfwWindowShouldClose(window)) { glfwSwapBuffers(window); glfwPollEvents(); } glfwTerminate(); return 0; } void framebuffer_size_callback(GLFWwindow* window, int width, int height) { glViewport(0, 0, width, height); } ``` 附: 操作系统是CentOS 6.10 glfw版本:3.2 glad版本:0.1.33 g++版本:4.4.7

keepalived 编译安装问题

我先 安装了 ipvsadm ,然后在安装 keepalived中出现了问题 ,错误日志如下 ar rv libipvs.a libipvs.o ip_vs_nl_policy.o ar: creating libipvs.a a - libipvs.o a - ip_vs_nl_policy.o make[2]: Leaving directory `/home/prod/keepalived-1.2.22/keepalived/libipvs-2.6' Building ../bin/keepalived libipvs-2.6/libipvs.a(libipvs.o): In function `ipvs_getinfo_parse_cb': /home/prod/keepalived-1.2.22/keepalived/libipvs-2.6/libipvs.c:193: undefined reference to `nlmsg_hdr' /home/prod/keepalived-1.2.22/keepalived/libipvs-2.6/libipvs.c:196: undefined reference to `genlmsg_parse' /home/prod/keepalived-1.2.22/keepalived/libipvs-2.6/libipvs.c:203: undefined reference to `nla_get_u32' /home/prod/keepalived-1.2.22/keepalived/libipvs-2.6/libipvs.c:204: undefined reference to `nla_get_u32' libipvs-2.6/libipvs.a(libipvs.o): In function `ipvs_parse_stats': /home/prod/keepalived-1.2.22/keepalived/libipvs-2.6/libipvs.c:594: undefined reference to `nla_parse_nested' /home/prod/keepalived-1.2.22/keepalived/libipvs-2.6/libipvs.c:609: undefined reference to `nla_get_u32' /home/prod/keepalived-1.2.22/keepalived/libipvs-2.6/libipvs.c:610: undefined reference to `nla_get_u32' /home/prod/keepalived-1.2.22/keepalived/libipvs-2.6/libipvs.c:611: undefined reference to `nla_get_u32' /home/prod/keepalived-1.2.22/keepalived/libipvs-2.6/libipvs.c:612: undefined reference to `nla_get_u64' /home/prod/keepalived-1.2.22/keepalived/libipvs-2.6/libipvs.c:613: undefined reference to `nla_get_u64' /home/prod/keepalived-1.2.22/keepalived/libipvs-2.6/libipvs.c:614: undefined reference to `nla_get_u32' /home/prod/keepalived-1.2.22/keepalived/libipvs-2.6/libipvs.c:615: undefined reference to `nla_get_u32' /home/prod/keepalived-1.2.22/keepalived/libipvs-2.6/libipvs.c:616: undefined reference to `nla_get_u32' /home/prod/keepalived-1.2.22/keepalived/libipvs-2.6/libipvs.c:617: undefined reference to `nla_get_u32' /home/prod/keepalived-1.2.22/keepalived/libipvs-2.6/libipvs.c:618: undefined reference to `nla_get_u32' libipvs-2.6/libipvs.a(libipvs.o): In function `ipvs_services_parse_cb': /home/prod/keepalived-1.2.22/keepalived/libipvs-2.6/libipvs.c:626: undefined reference to `nlmsg_hdr' /home/prod/keepalived-1.2.22/keepalived/libipvs-2.6/libipvs.c:634: undefined reference to `genlmsg_parse' /home/prod/keepalived-1.2.22/keepalived/libipvs-2.6/libipvs.c:640: undefined reference to `nla_parse_nested' /home/prod/keepalived-1.2.22/keepalived/libipvs-2.6/libipvs.c:656: undefined reference to `nla_get_u16' /home/prod/keepalived-1.2.22/keepalived/libipvs-2.6/libipvs.c:659: undefined reference to `nla_get_u32' /home/prod/keepalived-1.2.22/keepalived/libipvs-2.6/libipvs.c:667: undefined reference to `nla_get_string' collect2: ld 返回 1 make[1]: *** [all] 错误 1 make[1]: Leaving directory `/home/prod/keepalived-1.2.22/keepalived' make: *** [all] 错误 2 也不知道是怎样出错的 而我在另外的一台机器上 先安装keepalived ,就能编译成功

opencv 人脸识别detectMultiScale函数编译报错

我在android平台camera hardware中加入opencv的代码,编译出现了如下错误: undefined reference to 'cv::CascadeClassifier::detectMultiScale(cv::_InputArray const&, std::__1::vector<cv::Rect_<int>, std::__1::allocator<cv::Rect_<int> > >&, double, int, int, cv::Size_<int>, cv::Size_<int>)' 我在网上查询了资料好像与gnustl有关,但是在android.mk中有LOCAL_NDK_STL_VARIANT := gnustl_static。编译生成的so我也加到了camera编译生成so的mk文件中,还请大神帮忙解决下,谢谢

小白求问:编译报错 undefined reference to 如何解决

//头文件 #ifndef SLINKLIST_H #define SLINKLIST_H template <class elemType> class list { public: virtual void clear() = 0; virtual int length()const = 0; virtual void insert(int i, const elemType& x) = 0; virtual void remove(int i) = 0; virtual void traverse()const = 0; virtual ~list() {}; }; template<class elemType> class sLinkList :public list <elemType> { private: struct node{ elemType data; node* next, * tail; node(const elemType& x, node* n = nullptr) { data = x; next = n; } node() :next(nullptr) {} ~node() {} }; node* head; node* tail; int currentLength; node* move(int i)const; public: sLinkList(); ~sLinkList() {clear(); delete head; delete tail; } void clear(); int length()const { return currentLength; } void insert(int i, const elemType &x); void remove(int i); void traverse()const; void erase(const elemType &x, const elemType &y); }; #endif //实现文件 #include "sLinkList.h" #include <iostream> using namespace std; template<class elemType> typename sLinkList<elemType>::node* sLinkList<elemType>::move(int i)const { node* p = head; while (i-- >= 0) p = p->next; return p; } template<class elemType> sLinkList<elemType>::sLinkList() { head = new node; tail = new node; head->next = tail; currentLength = 0; } template<class elemType> void sLinkList<elemType>::clear() { node* p = head->next, * q; head->next = nullptr; while (p != tail) { q = p->next; delete p; p = q; } currentLength = 0; } template<class elemType> void sLinkList<elemType>::insert(int i, const elemType &x) { node* pos; pos = move(i - 1); pos->next = new node(x, pos->next); ++currentLength; } template<class elemType> void sLinkList<elemType>::remove(int i) { node* pos, * delp; pos = move(i - 1); delp = pos->next; pos->next = delp->next; delete delp; --currentLength; } template<class elemType> void sLinkList<elemType>::erase(const elemType &x, const elemType &y) { node* p; int i = 0; p = head; while (p->next!=tail) { if (p->next->data >= x && p->next->data <= y) remove(i); else { p = p->next; i++; } } } template<class elemType> void sLinkList<elemType>::traverse()const { node* p = head->next; cout << endl; while (p != tail) { cout << p->data << " "; p = p->next; } cout << endl; } //主函数 #include "sLinkList.h" #include <vector> #include <iostream> using namespace std; int main() { sLinkList<int> s; vector<int> v; int tmp,x,y; while (cin >> tmp) { v.push_back(tmp); if (getchar() == '\n') break; } for (unsigned int i = 0; i < v.size(); i++) { s.insert(i, v[i]); } cin >> x >> y; s.erase(x, y); s.length(); s.traverse(); return 0; }

centos 下编译ImageMagick 无法通过报错undefined reference to `gzdirect@ZLIB_1.2.2.3'

[root@local-vm-380 ImageMagick-6.9.10-86]# m make all-am make[1]: Entering directory `/usr/src/ImageMagick-6.9.10-86' CCLD utilities/animate /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libxml2.so: undefined reference to `gzdirect@ZLIB_1.2.2.3' /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libxml2.so: undefined reference to `gzopen64@ZLIB_1.2.3.3' collect2: error: ld returned 1 exit status make[1]: *** [utilities/animate] Error 1 make[1]: Leaving directory `/usr/src/ImageMagick-6.9.10-86' make: *** [all] Error 2 [root@local-vm-380 ImageMagick-6.9.10-86]#

请教:尝试opencv2.4.13在linux下编译程序的报错

源代码:#include <opencv2/highgui/highgui.hpp> #include <opencv2/imgproc/imgproc.hpp> #include <opencv2/core/core.hpp> using namespace cv; int main() { VideoCapture cap(0); if(!cap.isOpened()) { return -1; } Mat frame; bool stop = false; while(!stop) { cap.read(frame); imshow("Video",frame); if(waitKey(30)==27) //Esc键退出 { stop = true; } } return 0; } 报错:~$ g++ -o opencvq opencv.cpp /tmp/ccQJKVIi.o: In function `main': opencv.cpp:(.text+0x29): undefined reference to `cv::VideoCapture::VideoCapture(int)' opencv.cpp:(.text+0x38): undefined reference to `cv::VideoCapture::isOpened() const' opencv.cpp:(.text+0x80): undefined reference to `cv::VideoCapture::read(cv::Mat&)' opencv.cpp:(.text+0xf9): undefined reference to `cv::Mat::ones(cv::Size_<int>, int)' opencv.cpp:(.text+0x146): undefined reference to `cv::VideoCapture::read(cv::Mat&)' opencv.cpp:(.text+0x33d): undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)' opencv.cpp:(.text+0x356): undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)' opencv.cpp:(.text+0x36f): undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)' opencv.cpp:(.text+0x3a1): undefined reference to `cv::addWeighted(cv::_InputArray const&, double, cv::_InputArray const&, double, double, cv::_OutputArray const&, int)' opencv.cpp:(.text+0x3ba): undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)' opencv.cpp:(.text+0x3fd): undefined reference to `cv::imshow(std::string const&, cv::_InputArray const&)' opencv.cpp:(.text+0x425): undefined reference to `cv::waitKey(int)' opencv.cpp:(.text+0x489): undefined reference to `cv::VideoCapture::~VideoCapture()' opencv.cpp:(.text+0x51a): undefined reference to `cv::VideoCapture::~VideoCapture()' /tmp/ccQJKVIi.o: In function `cv::Mat::~Mat()': opencv.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x39): undefined reference to `cv::fastFree(void*)' /tmp/ccQJKVIi.o: In function `cv::Mat::release()': opencv.cpp:(.text._ZN2cv3Mat7releaseEv[_ZN2cv3Mat7releaseEv]+0x47): undefined reference to `cv::Mat::deallocate()' /tmp/ccQJKVIi.o: In function `cv::Mat::operator()(cv::Rect_<int> const&) const': opencv.cpp:(.text._ZNK2cv3MatclERKNS_5Rect_IiEE[_ZNK2cv3MatclERKNS_5Rect_IiEE]+0x27): undefined reference to `cv::Mat::Mat(cv::Mat const&, cv::Rect_<int> const&)' collect2: error: ld returned 1 exit status 第一次使用,在此请教各位前辈,谢谢了

怎么解决 undefined reference to AAssetManager_FromJava

我用cmake 编译 一个c++项目时出现 ``` undefined reference to AAssetManager_FromJava ``` 非AndroidStudio环境下 如果在 AndroidStudio下 gradle里加 ``` find_libary(android) ``` 是可以的 但是我在外部环境中用find_libary报找不到 ``` android-config.cmake ``` Android.mk可以编译通过 我知道应该是相关的静态库没有链接上, 可不知道该如何处理 请问如何处理可以用 cmake 编译通过 用的是cmake 3.6, toolchain是ndk自带的android.toolchain.cmake

libmp3lame编译出现:undefined reference to 'hip_decode'

![图片说明](https://img-ask.csdn.net/upload/201512/11/1449801757_294680.jpg) 这是出问题的地方,这三个方法在mpglib_interface.c文件中 ![图片说明](https://img-ask.csdn.net/upload/201512/11/1449801858_108981.png) 下面是Android.mk文件 ![图片说明](https://img-ask.csdn.net/upload/201512/11/1449801944_736596.png) 下面是报错信息 ![图片说明](https://img-ask.csdn.net/upload/201512/11/1449802127_857936.png) 这个错误怎么解决?

大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了

大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...

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

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

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

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

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

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

和黑客斗争的 6 天!

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

点沙成金:英特尔芯片制造全过程揭密

“亚马逊丛林里的蝴蝶扇动几下翅膀就可能引起两周后美国德州的一次飓风……” 这句人人皆知的话最初用来描述非线性系统中微小参数的变化所引起的系统极大变化。 而在更长的时间尺度内,我们所生活的这个世界就是这样一个异常复杂的非线性系统…… 水泥、穹顶、透视——关于时间与技艺的蝴蝶效应 公元前3000年,古埃及人将尼罗河中挖出的泥浆与纳特龙盐湖中的矿物盐混合,再掺入煅烧石灰石制成的石灰,由此得来了人...

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

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

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

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

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

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

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

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

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

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

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

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

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

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

我说我不会算法,阿里把我挂了。

不说了,字节跳动也反手把我挂了。

优雅的替换if-else语句

场景 日常开发,if-else语句写的不少吧??当逻辑分支非常多的时候,if-else套了一层又一层,虽然业务功能倒是实现了,但是看起来是真的很不优雅,尤其是对于我这种有强迫症的程序"猿",看到这么多if-else,脑袋瓜子就嗡嗡的,总想着解锁新姿势:干掉过多的if-else!!!本文将介绍三板斧手段: 优先判断条件,条件不满足的,逻辑及时中断返回; 采用策略模式+工厂模式; 结合注解,锦...

离职半年了,老东家又发 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多个条件是什么逻辑关系?条件判断在什么时候执...

你打算用Java 8一辈子都不打算升级到Java 14,真香

我们程序员应该抱着尝鲜、猎奇的心态,否则就容易固步自封,技术停滞不前。

无代码时代来临,程序员如何保住饭碗?

编程语言层出不穷,从最初的机器语言到如今2500种以上的高级语言,程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新,一边面临由于许多代码已存在,程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法,它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中,可视化建模来组装和配置应用程序。这样一来,开发者直...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

《经典算法案例》01-08:如何使用质数设计扫雷(Minesweeper)游戏

我们都玩过Windows操作系统中的经典游戏扫雷(Minesweeper),如果把质数当作一颗雷,那么,表格中红色的数字哪些是雷(质数)?您能找出多少个呢?文中用列表的方式罗列了10000以内的自然数、质数(素数),6的倍数等,方便大家观察质数的分布规律及特性,以便对算法求解有指导意义。另外,判断质数是初学算法,理解算法重要性的一个非常好的案例。

《Oracle Java SE编程自学与面试指南》最佳学习路线图(2020最新版)

正确选择比瞎努力更重要!

一文带你入门Java Stream流,太强了

两个星期以前,就有读者强烈要求我写一篇 Java Stream 流的文章,我说市面上不是已经有很多了吗,结果你猜他怎么说:“就想看你写的啊!”你看你看,多么苍白的喜欢啊。那就“勉为其难”写一篇吧,嘻嘻。 单从“Stream”这个单词上来看,它似乎和 java.io 包下的 InputStream 和 OutputStream 有些关系。实际上呢,没毛关系。Java 8 新增的 Stream 是为...

立即提问
相关内容推荐