- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试在 Linux 上安装 QScintilla-gpl-2.7.12.6.32-279。 #1 SMP 2012 x86_64 x86_64 x86_64 GNU/Linux
我已经在上一篇文章中解决了这个问题。但是,我遇到了链接器错误的新问题:
花了我一周的时间还是找不到原因。
即使我试过了,旧帖子也帮不了我。任何帮助将不胜感激。
链接命令:
$(TARGET): $(OBJECTS)
$(LINK) $(LFLAGS) -o $(TARGET) $(LIBS) $(OBJECTS) $(LIBS_SUFFIX) $(OBJCOMP)
OBJECTS = ListBoxQt.o \
PlatQt.o \
qsciabstractapis.o \
qsciapis.o \
..........
LIBS = -L/home/user/myPath/qt483/qt-everywhere-opensource-src-4.8.3/lib
LFLAGS = -Wl,-O1
LINK = g++
LIBS_SUFFIX = -lQtCore -lQtGui -lQt3Support -lQtCLucene -lQtDeclarative -lQtDesigner -lQtDesignerComponents - lQtHelp -lQtMultimedia -lQtNetwork -lQtOpenGL -lQtScript - lQtScriptTools -lQtSql -lQtSvg -lQtTest -lQtWebKit -lQtXml -lQtXmlPatterns -lpthread
OBJCOMP is not defined.
错误:
qscintilla2/QScintilla-gpl-2.7.1/src/Indicator.o: In function `Indicator::Draw(Surface*, PRectangle const&, PRectangle const&)':
Indicator.cpp:(.text+0x409): undefined reference to `RGBAImage::RGBAImage(int, int, float, unsigned char const*)'
Indicator.cpp:(.text+0x43d): undefined reference to `RGBAImage::SetPixel(int, int, ColourDesired, int)'
Indicator.cpp:(.text+0x456): undefined reference to `RGBAImage::SetPixel(int, int, ColourDesired, int)'
Indicator.cpp:(.text+0x47a): undefined reference to `RGBAImage::SetPixel(int, int, ColourDesired, int)'
Indicator.cpp:(.text+0x493): undefined reference to `RGBAImage::SetPixel(int, int, ColourDesired, int)'
Indicator.cpp:(.text+0x4ac): undefined reference to `RGBAImage::SetPixel(int, int, ColourDesired, int)'
Indicator.cpp:(.text+0x4c7): undefined reference to `RGBAImage::Pixels() const'
Indicator.cpp:(.text+0x50f): undefined reference to `RGBAImage::~RGBAImage()'
Indicator.cpp:(.text+0x900): undefined reference to `RGBAImage::RGBAImage(int, int, float, unsigned char const*)'
Indicator.cpp:(.text+0x94e): undefined reference to `RGBAImage::SetPixel(int, int, ColourDesired, int)'
Indicator.cpp:(.text+0x9f9): undefined reference to `RGBAImage::SetPixel(int, int, ColourDesired, int)'
Indicator.cpp:(.text+0xa4b): undefined reference to `RGBAImage::Pixels() const'
Indicator.cpp:(.text+0xac7): undefined reference to `RGBAImage::~RGBAImage()'
/qscintilla2/QScintilla-gpl-2.7.1/src/LineMarker.o: In function `LineMarker::Draw(Surface*, PRectangle&, Font&, LineMarker::typeOfFold, int)':
LineMarker.cpp:(.text+0x2fd): undefined reference to `RGBAImage::Pixels() const'
LineMarker.cpp:(.text+0x3e3): undefined reference to `XPM::Draw(Surface*, PRectangle&)'
qscintilla2/QScintilla-gpl-2.7.1/src/LineMarker.o: In function `LineMarker::SetRGBAImage(Point, float, unsigned char const*)':
LineMarker.cpp:(.text+0x1648): undefined reference to `RGBAImage::RGBAImage(int, int, float, unsigned char const*)'
qscintilla2/QScintilla-gpl-2.7.1/src/LineMarker.o: In function `LineMarker::SetXPM(char const* const*)':
LineMarker.cpp:(.text+0x16c6): undefined reference to `XPM::XPM(char const* const*)'
qscintilla2/QScintilla-gpl-2.7.1/src/LineMarker.o: In function `LineMarker::SetXPM(char const*)':
LineMarker.cpp:(.text+0x1746): undefined reference to `XPM::XPM(char const*)'
collect2: ld returned 1 exit status
src/XPM.h 中类 RGBAImage 的定义。
没有编译错误,但是链接器找不到XPM.h中定义的RGBAImage,它已经包含在Indicator.cpp和Indicator.cpp中。
在 Makefile 中,Indicator.o 和 Indicator.o 可以毫无问题地生成,并且已放入链接器输入参数列表中,但链接器错误仍然存在。没有 XPM.cpp 文件。但是即使我创建了一个包含 XPM.h 的 XPM.cpp 文件并得到了 XPM.o,我也遇到了同样的错误。
#include <vector>
#include <map>
#include "Platform.h"
#include "Scintilla.h"
#include "XPM.h" // RGBAImage is defined here
#include "Indicator.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static PRectangle PixelGridAlign(const PRectangle &rc) {
// Move left and right side to nearest pixel to avoid blurry visuals
return PRectangle(int(rc.left + 0.5), rc.top, int(rc.right + 0.5), rc.bottom);
}
void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine)
{
surface->PenColour(fore);
int ymid = (rc.bottom + rc.top) / 2;
if (style == INDIC_SQUIGGLE) {
int x = int(rc.left+0.5);
int xLast = int(rc.right+0.5);
int y = 0;
surface->MoveTo(x, rc.top + y);
while (x < xLast) {
if ((x + 2) > xLast) {
if (xLast > x)
y = 1;
x = xLast;
} else {
x += 2;
y = 2 - y;
}
surface->LineTo(x, rc.top + y);
}
} else if (style == INDIC_SQUIGGLEPIXMAP) {
PRectangle rcSquiggle = PixelGridAlign(rc);
int width = Platform::Minimum(4000, rcSquiggle.Width());
RGBAImage image(width, 3, 1.0, 0);
enum { alphaFull = 0xff, alphaSide = 0x2f, alphaSide2=0x5f };
for (int x = 0; x < width; x++) {
if (x%2) {
// Two halfway columns have a full pixel in middle flanked by light pixels
image.SetPixel(x, 0, fore, alphaSide);
image.SetPixel(x, 1, fore, alphaFull);
image.SetPixel(x, 2, fore, alphaSide);
} else {
// Extreme columns have a full pixel at bottom or top and a mid-tone pixel in centre
image.SetPixel(x, (x%4) ? 0 : 2, fore, alphaFull);
image.SetPixel(x, 1, fore, alphaSide2);
}
}
surface->DrawRGBAImage(rcSquiggle, image.GetWidth(), image.GetHeight(), image.Pixels());
} else if (style == INDIC_SQUIGGLELOW) {
surface->MoveTo(rc.left, rc.top);
int x = rc.left + 3;
int y = 0;
while (x < rc.right) {
surface->LineTo(x-1, rc.top + y);
y = 1 - y;
surface->LineTo(x, rc.top + y);
x += 3;
}
surface->LineTo(rc.right, rc.top + y); // Finish the line
} else if (style == INDIC_TT) {
surface->MoveTo(rc.left, ymid);
int x = rc.left + 5;
while (x < rc.right) {
surface->LineTo(x, ymid);
surface->MoveTo(x-3, ymid);
surface->LineTo(x-3, ymid+2);
x++;
surface->MoveTo(x, ymid);
x += 5;
}
surface->LineTo(rc.right, ymid); // Finish the line
if (x - 3 <= rc.right) {
surface->MoveTo(x-3, ymid);
surface->LineTo(x-3, ymid+2);
}
} else if (style == INDIC_DIAGONAL) {
int x = rc.left;
while (x < rc.right) {
surface->MoveTo(x, rc.top+2);
int endX = x+3;
int endY = rc.top - 1;
if (endX > rc.right) {
endY += endX - rc.right;
endX = rc.right;
}
surface->LineTo(endX, endY);
x += 4;
}
} else if (style == INDIC_STRIKE) {
surface->MoveTo(rc.left, rc.top - 4);
surface->LineTo(rc.right, rc.top - 4);
} else if (style == INDIC_HIDDEN) {
// Draw nothing
} else if (style == INDIC_BOX) {
surface->MoveTo(rc.left, ymid+1);
surface->LineTo(rc.right, ymid+1);
surface->LineTo(rc.right, rcLine.top+1);
surface->LineTo(rc.left, rcLine.top+1);
surface->LineTo(rc.left, ymid+1);
} else if (style == INDIC_ROUNDBOX || style == INDIC_STRAIGHTBOX) {
PRectangle rcBox = rcLine;
rcBox.top = rcLine.top + 1;
rcBox.left = rc.left;
rcBox.right = rc.right;
surface->AlphaRectangle(rcBox, (style == INDIC_ROUNDBOX) ? 1 : 0, fore, fillAlpha, fore, outlineAlpha, 0);
} else if (style == INDIC_DOTBOX) {
PRectangle rcBox = PixelGridAlign(rc);
rcBox.top = rcLine.top + 1;
rcBox.bottom = rcLine.bottom;
// Cap width at 4000 to avoid large allocations when mistakes made
int width = Platform::Minimum(rcBox.Width(), 4000);
RGBAImage image(width, rcBox.Height(), 1.0, 0);
// Draw horizontal lines top and bottom
for (int x=0; x<width; x++) {
for (int y=0; y<rcBox.Height(); y += rcBox.Height()-1) {
image.SetPixel(x, y, fore, ((x + y) % 2) ? outlineAlpha : fillAlpha);
}
}
// Draw vertical lines left and right
for (int y=1; y<rcBox.Height(); y++) {
for (int x=0; x<width; x += width-1) {
image.SetPixel(x, y, fore, ((x + y) % 2) ? outlineAlpha : fillAlpha);
}
}
surface->DrawRGBAImage(rcBox, image.GetWidth(), image.GetHeight(), image.Pixels());
} else if (style == INDIC_DASH) {
int x = rc.left;
while (x < rc.right) {
surface->MoveTo(x, ymid);
surface->LineTo(Platform::Minimum(x + 4, rc.right), ymid);
x += 7;
}
} else if (style == INDIC_DOTS) {
int x = rc.left;
while (x < rc.right)
{
PRectangle rcDot(x, ymid, x+1, ymid+1);
surface->FillRectangle(rcDot, fore);
x += 2;
}
}
else
{ // Either INDIC_PLAIN or unknown
surface->MoveTo(rc.left, ymid);
surface->LineTo(rc.right, ymid);
}
}
----------------------------------
XPM.h
# pragma once
#include "Platform.h"
#if defined(PLAT_QT)
#include <qimage.h>
#include <qpixmap.h>
#endif
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
/**
* Hold a pixmap in XPM format.
*/
class XPM {
#if defined(PLAT_QT)
QPixmap qpm;
public:
XPM(const char *textForm);
XPM(const char *const *linesForm);
~XPM() {}
void Draw(Surface *surface, PRectangle &rc);
int GetHeight() const {return qpm.height();}
const QPixmap &Pixmap() const {return qpm;}
#else
int pid; // Assigned by container
int height;
int width;
int nColours;
char *data;
char codeTransparent;
char *codes;
ColourDesired *colours;
ColourDesired ColourDesiredFromCode(int ch) const;
ColourDesired ColourFromCode(int ch) const;
void FillRun(Surface *surface, int code, int startX, int y, int x);
char **lines;
ColourDesired *colourCodeTable[256];
public:
XPM(const char *textForm);
XPM(const char *const *linesForm);
~XPM();
void Init(const char *textForm);
void Init(const char *const *linesForm);
void Clear();
/// Decompose image into runs and use FillRectangle for each run
void Draw(Surface *surface, PRectangle &rc);
char **InLinesForm() { return lines; }
void SetId(int pid_) { pid = pid_; }
int GetId() const { return pid; }
int GetHeight() const { return height; }
int GetWidth() const { return width; }
void PixelAt(int x, int y, ColourDesired &colour, bool &transparent) const;
static const char **LinesFormFromTextForm(const char *textForm);
#endif
};
#if !defined(PLAT_QT)
/**
* A collection of pixmaps indexed by integer id.
*/
class XPMSet {
XPM **set; ///< The stored XPMs.
int len; ///< Current number of XPMs.
int maximum; ///< Current maximum number of XPMs, increased by steps if reached.
int height; ///< Memorize largest height of the set.
int width; ///< Memorize largest width of the set.
public:
XPMSet();
~XPMSet();
/// Remove all XPMs.
void Clear();
/// Add a XPM.
void Add(int ident, const char *textForm);
/// Get XPM by id.
XPM *Get(int ident);
/// Give the largest height of the set.
int GetHeight();
/// Give the largest width of the set.
int GetWidth();
};
#endif
/**
* An translucent image stoed as a sequence of RGBA bytes.
*/
class RGBAImage {
// Private so RGBAImage objects can not be copied
RGBAImage(const RGBAImage &);
RGBAImage &operator=(const RGBAImage &);
int height;
int width;
float scale;
#if defined(PLAT_QT)
QImage *qim;
#else
std::vector<unsigned char> pixelBytes;
#endif
public:
// RGBAImage has been defined here, why still linker error ???
RGBAImage(int width_, int height_, float scale_, unsigned char const *pixels_);
RGBAImage(const XPM &xpm);
virtual ~RGBAImage();
int GetHeight() const { return height; }
int GetWidth() const { return width; }
float GetScale() const { return scale; }
float GetScaledHeight() const { return height / scale; }
float GetScaledWidth() const { return width / scale; }
#if !defined(PLAT_QT)
int CountBytes() const;
#endif
const unsigned char *Pixels() const;
// SetPixel has been defined here, why still linker error ???
void SetPixel(int x, int y, ColourDesired colour, int alpha=0xff);
};
#if !defined(PLAT_QT)
/**
* A collection of RGBAImage pixmaps indexed by integer id.
*/
class RGBAImageSet {
typedef std::map<int, RGBAImage*> ImageMap;
ImageMap images;
mutable int height; ///< Memorize largest height of the set.
mutable int width; ///< Memorize largest width of the set.
public:
RGBAImageSet();
~RGBAImageSet();
/// Remove all images.
void Clear();
/// Add an image.
void Add(int ident, RGBAImage *image);
/// Get image by id.
RGBAImage *Get(int ident);
/// Give the largest height of the set.
int GetHeight() const;
/// Give the largest width of the set.
int GetWidth() const;
};
#endif
#ifdef SCI_NAMESPACE
}
我再次解压了 tar ball,找到了 XMP.cpp 并运行 qmake (4.8.3) qscintilla.proa 并得到了 Makefile。但是我遇到了很多编译错误。例如
Qsci/qsciscintilla.h:34:21: 错误:qobject.h: 没有这样的文件或目录。我已经更新了我的帖子。
[~/qscintilla2/QScintilla-gpl-2.7.1_new/QScintilla-gpl-2.7.1/Qt4Qt5] $ make
g++ -c -pipe -O2 -D_REENTRANT -w -fPIC -DQSCINTILLA_MAKE_DLL -DQT -DSCI_LEXER - DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I../../../../qt483/qt-everywhere-opensource-src- 4.8.3/mkspecs/linux-g++ -I. -I/home/user//qt483/include/QtCore - I/home/user/qt483/include/QtGui -I/home/user/qt483/include -I. -I../include - I../lexlib -I../src -I. -o qsciscintilla.o qsciscintilla.cpp
In file included from qsciscintilla.cpp:28:
Qsci/qsciscintilla.h:34:21: error: qobject.h: No such file or directory
Qsci/qsciscintilla.h:35:25: error: qstringlist.h: No such file or directory
Qsci/qsciscintilla.h:37:22: error: QByteArray: No such file or directory
Qsci/qsciscintilla.h:38:17: error: QList: No such file or directory
Qsci/qsciscintilla.h:39:20: error: QPointer: No such file or directory
In file included from Qsci/qsciscintilla.h:41,
from qsciscintilla.cpp:28:
./Qsci/qsciglobal.h:33:21: error: qglobal.h: No such file or directory
In file included from Qsci/qsciscintilla.h:42,
from qsciscintilla.cpp:28:
./Qsci/qscicommand.h:33:21: error: qstring.h: No such file or directory
In file included from ./Qsci/qscicommand.h:36,
from Qsci/qsciscintilla.h:42,
from qsciscintilla.cpp:28:
./Qsci/qsciscintillabase.h:35:31: error: QAbstractScrollArea: No such file or directory
./Qsci/qsciscintillabase.h:37:20: error: qpoint.h: No such file or directory
./Qsci/qsciscintillabase.h:38:20: error: qtimer.h: No such file or directory
qsciscintilla.cpp:31:21: error: qaction.h: No such file or directory
qsciscintilla.cpp:32:26: error: qapplication.h: No such file or directory
qsciscintilla.cpp:33:20: error: qcolor.h: No such file or directory
qsciscintilla.cpp:34:20: error: qevent.h: No such file or directory
qsciscintilla.cpp:35:20: error: qimage.h: No such file or directory
qsciscintilla.cpp:36:23: error: qiodevice.h: No such file or directory
qsciscintilla.cpp:37:26: error: qkeysequence.h: No such file or directory
qsciscintilla.cpp:40:19: error: qmenu.h: No such file or directory
In file included from qsciscintilla.cpp:44:
Qsci/qscilexer.h:34:19: error: qfont.h: No such file or directory
Qsci/qscilexer.h:35:18: error: qmap.h: No such file or directory
In file included from ./Qsci/qscicommand.h:36,
from Qsci/qsciscintilla.h:42,
from qsciscintilla.cpp:28:
./Qsci/qsciscintillabase.h:69: error: expected class-name before '{' token
./Qsci/qsciscintillabase.h:70: error: ISO C++ forbids declaration of 'Q_OBJECT' with no type
./Qsci/qsciscintillabase.h:72: error: expected ';' before 'public'
./Qsci/qsciscintillabase.h:3011: error: expected ')' before '*' token
更新 Makefile 的 lib 路径并按照 QScintilla-gpl-2.7.1/doc/html-Qt4Qt5/index.html 上的安装说明进行操作后,我编译并安装了 QScintilla-gpl-2.7.1,没有错误。
但是,当我运行 example-Qt4Qt5/application 时出现了新的错误:
~/qscintilla2/QScintilla-gpl-2.7.1_new/QScintilla-gpl-2.7.1/example-Qt4Qt5] $ ./application
Unable to load library icui18n "Cannot load library icui18n: (icui18n: cannot open shared object file: No such file or directory)"
最佳答案
The definition of class RGBAImage in src/XPM.h.
链接器不是在提示类的定义,而是在提示 XPM.cpp 中定义的类成员函数的定义
那应该在压缩包里,所以你一定是在提取代码的时候做错了什么。
关于C++ 链接器错误 undefined reference to a class definition and its member functions on Linux,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15865083/
我刚用 Latex 写完微积分的总结。 现在的主要问题是文件中包含许多我现在并不真正需要的东西。 .tex 文件包含许多我需要用心学习的定义和定理。 定义在 tex 文件中有自己的定义,因此文件中的任
所以我有一个菜单项列表,我想弄清楚我是否应该使用具有类属性的跨度或每个元素的特征的定义列表。以下是我正在考虑的两个选项: 选项 1) // HAML Markup %article.menu-item
考虑下面的代码,它试图实现 class Bar 的部分特化。 .在第一种情况下,foo成员函数是内联定义的,在第二种情况下是外联的。行外定义产生了一个我无法弄清楚的编译错误:error: out-of
我正在使用 Visual Studio Code 开发一个 typescript 项目,包括多个结构如下的 npm 包: 源代码:/src/index.ts 编译后的代码:/dist/... 当我右键
我正在编写一个神经网络类,遇到了两个我不理解的概念。谁能告诉我bias 和momentum 是什么以及做什么 最佳答案 偏差是给予神经元的恒定输入。例如在普通的前馈网络中,您可能有 2 个输入单元、2
假设我在功能文件中有一个场景,如下所示 Given I log in as "super" user When I click on login Then Home page is displayed
关闭。这个问题是opinion-based 。目前不接受答案。 已关闭去年。 已锁定。这个问题及其答案是locked因为这个问题是题外话,但却具有历史意义。目前不接受新的答案或互动。 我读了很多这个词
就像几乎任何一个已经编程了一段时间的人一样,我熟悉“生产代码”这个术语,并且对其含义有一个模糊的认识。然而,有人可以提供一个半严格的定义吗,因为维基百科和谷歌似乎不能?在生产中似乎存在很多灰色地带,例
以下代码是我认为符合伪代码条件的示例,因为它不以任何语言执行,但逻辑是正确的。 string checkRubric(gpa, major) bool brake = false nu
从宠物商店示例中获取以下#definition。给定#definition部分,可以生成JSON结构 例如 给定一个较大的复杂JSON文件,是否可以做一些相反的事情? 给定下面的JSON结构,我可以获
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 想改进这个问题?将问题更新为 on-topic对于堆栈溢出。 7年前关闭。 Improve this qu
很难说出这里问的是什么。这个问题是模棱两可的、模糊的、不完整的、过于宽泛的或修辞的,无法以目前的形式得到合理的回答。如需帮助澄清这个问题以便重新打开它,visit the help center .
Joel Spolsky 在 SO 播客中提到了“浮出水面”。 这是什么意思?它是类似于“暴露”的东西吗,比如“暴露接口(interface)”? 最佳答案 这里引用自 podcast 51 的文字记
我不断遇到这个词的用法,但我从来不理解它的用法或所传达的含义。 像...这样的短语 "add semantics for those who read" "HTML5 semantics" "sema
我正在学习 lisp 语言(做 lisp 例程),在一般情况下我知道什么是例程,但在技术上下文中我可以谈论它,因为我现在开始学习例程。那么,例行公事的真正定义是什么?(我已经用谷歌搜索过这个,但没有找
在 definition of the haskell prelude我们看到 ... 是为无法在 Haskell 中实现的表达式保留的。例如,现在 IO monad 无法在 haskell 中实现。
问题: 原来有单个文件tcpclient.c,运行gcc -o tcpclient tcpclient.c可以顺利完成编译,并能与下载到目标板中的tcpserver成功通讯; 现在把tcpclien
我使用 ergoemacs-mode、clojuremode 和自动完成 自动完成效果很好。我应该按什么才能进入函数的定义?我习惯了 Cursive,但我想使用免费的 Emacs,我需要去定义功能。
我对 nearly.js 很陌生,我想知道与规则相比,分词器/词法分析器做了什么,根据网站: By default, nearley splits the input into a stream of
我正在使用 Gforth ,我想在定义中创建一个词。在 Gforth 的 cmd 行中,我可以输入: create foo ok 或者更具体地说,我定义了一个数组函数,它期望堆栈上的大小并创建一个带有
我是一名优秀的程序员,十分优秀!