- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我一直在尝试配置 Eclipse CDT(在 Ubuntu Precise 上)以使用 wxWidgets 编译程序。我在使用 Eclipse 时收到错误,但该程序使用我提供的 makefile 编译得很好。我已按照 http://wiki.wxwidgets.org/Eclipse#Linux 中给出的说明进行操作,但仍然没有成功。 (即,我相信我已经正确设置了编译器和链接器标志。)
我的头文件如下:
#ifndef READIMAGE_H_
#define READIMAGE_H_
class Image{
wxImage *loadedImage;
public:
Image(string filename);
void loadImage(string filename){};
};
#endif /* READIMAGE_H_ */
我的源文件如下:
#include <wx/wx.h>
#include <wx/image.h>
#include <iostream>
using namespace std;
#include "readImage.h"
Image::Image(string file){
loadImage(file);
}
int main(){
Image img("example.jpg");
}
我收到的错误是:
make: *** [Image_IO] Error 1
Type 'wxImage' could not be resolved
undefined reference to `wxRect2DInt::operator=(wxRect2DInt const&)'
undefined reference to `wxRect2DInt::operator=(wxRect2DInt const&)'
undefined reference to `wxThread::~wxThread()'
如果这有帮助,makefile 如下:
INCS =
LIBP =
ARCH_CFLAGS =
#The code below should be used rather than the
#specific 2.4 version one. With this one we ensure
#that we run the latest release of wxGTK rather
#than a specific one:
WX_LIBS = `wx-config --libs --gl-libs`
WX_FLAGS = `wx-config --cxxflags`
LIBS = $(WX_LIBS)
ARCH_CFLAGS =
EXES = readImage
CFLAGS = $(ARCH_CFLAGS) $(WX_FLAGS) -Wall -Wno-unused -Wno-reorder \
-O3 -fomit-frame-pointer -fforce-addr
# ------------------
all : clean $(EXES)
clean :
find -name "*.o" -exec rm {} \;
rm -f ${EXES} -R
# ------------------
readImage : readImage.o
g++ readImage.o -o readImage $(ARCH_CFLAGS) $(LIBS) $(CFLAGS)
readImage.o : readImage.cpp readImage.h
g++ -c readImage.cpp $(ARCH_CFLAGS) $(INCS) $(WX_FLAGS)
# ------------------
有什么想法吗?
非常感谢。
编辑
在 C++ 编译器和链接器的命令行模式中(分别为项目>属性>GCC C++ 编译器和>GCC C++ 链接器),如果我将 ${FLAGS} 移动到模式的末尾,那么我只会收到一个错误:
Type 'wxImage' could not be resolved
注意我没有收到任何包含的警告,提示编译器和链接器可以找到这些库。
最佳答案
问题已解决。
按照我的帖子 EDIT 中的步骤操作后,我尝试通过终端在 makefile 上运行 make 命令。该程序编译正常,所以我认为它只是代码分析工具。我最终转到 Project>Properties>C/C++ General>Code Analysis>Launching 并取消选择 run as you type 并选择 run with build 选项。
我假设这会强制 Eclipse 使用编译器输出来创建错误和警告,而不是使用其他一些内置方法。不过,也许有人可以澄清这一点。
注意:在这些步骤生效之前我需要重启eclipse。
非常感谢。
关于c++ - 配置 Eclipse CDT 以使用 wxWidgets,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21865741/
我已经用 eclipse-cdt 很好地设置了一个项目。我不是从 eclipse 构建的,但是索引器可以工作,并且我的所有 makefile 设置都被选中,包括第三方库头文件。 然而,我想要的是能够查
我正在使用 Eclipse IDE for C/C++ Developers (Eclipse Ganymede Package - version 3.4.2)在 Windows XP 上使用 Mi
在 eclipse CDT 4.2 中,我只想包含几个文件夹作为资源。例如“/root”是创建项目“myproject”的地方。我只想包含这些文件夹并排除任何其他文件夹。 /根/A /根目录/B /根
我已经下载了最新的 Eclipse CDT 版本 (Helios),并想尝试一些 C++ 编程(很久没有这样做了)。 我试图做“Hello World”项目,但我很快就卡住了。 第一件事 - #inc
我已经离开 Eclipse CDT 一段时间了,并且被 JetBrains 优秀的 IDE 宠坏了(公司不让我拥有 Clion )。诚然,这些主要用于解释型语言,而不是编译型语言,因此评估更简单。 当
有没有办法让 Eclipse CDT 在每次构建项目时自动增加构建版本号?我可以找到 ANT 的解决方案,但我知道这仅适用于 Java 项目。 最佳答案 不,ANT 不仅适用于 Java 项目。它主要
我在 C++ Makefile 项目中使用 Eclipse CDT(Helios 版本,CDT 7.0)。由于我是 Eclipse 的新手,我想知道如何正确管理包含目录。我#include 通常没有任
我有一个包含多个项目的工作区,所有项目都可以正常编译。然而,由于未解析的包含,一些项目在编辑器中给出了很多关于未解析符号的警告。大多数是来自工作区中其他项目或第三方库的头文件。 谷歌搜索表明这是索引器
我想将我的 CDT 项目提交给 SVN。我是关于 CDT 的新手,我想知道描述该项目的文件。 相关文件似乎是: 。项目 .settings(目录) .c项目 .csettings(目录) .proje
有没有办法在eclipse CDT中为类生成模板自定义包含保护的格式?当前格式为 _H ,但我想要的是类似 ___H .并不是说我希望在我自己的项目中的不同命名空间中有同名的类,但我不想在出现这种情况
每当我从构建中排除 .h 文件并稍后重新包含它时,项目资源管理器中的 .h 文件的图标都会有一个图钉装饰。我查看了 CDT 用户指南,但它不在他们的 list of icons 上。图钉是什么意思?
使用 Eclipse CDT 7.0,在进行 headless 构建时,是否可以指定在命令行上仅构建单个构建配置? 最佳答案 我想我找到了自己问题的答案,主要是通过玩 CDT 8.0 和 indigo
有没有办法在 Eclipse 2020-03 (CDT 9.11) 中启用对 C++20 功能的支持?我的意思是摆脱不正确的语法高亮显示,例如忽略新添加的关键字,如“概念”、“要求”和 C++20 标
我在 Linux 上使用 Eclipse (galileo) 和当前版本的 CDT。而且我不能设置断点!它运行起来很有趣,调试得很好,并在 main 中停止……但是像我多年前用 CDT 那样双击左边距
我最近(实际上是今天)开始使用 Eclipse CDT for windows。创建了一个项目,将一个测试 C 文件(Hello World)添加到项目中。构建项目,出现如下错误。 Error: Pr
我有一个 chroot 环境,其中包含使用 make 构建复杂 C++ 项目所需的一切(适用于特定的 Linux 发行版)。 我想在这个项目中使用 Eclipse CDT(在 chroot 环境之外)
eclipse cdt 如何使用 TM/RSE 管理和构建远程文件??是否有使用 Windows 中的 Eclipse CDT 和 Linux 中的源代码和编译器的项目用法示例? 腾讯 最佳答案 Ta
我正在测试 Eclipse 的 CDT 包。我正在尝试用 C 编译和运行一个简单的 Hello World 程序。 #include int main(void { printf("
大家好, 我已经使用 GCC 安装了 Eclipse CDT 和 MinGW。 将 mingw\bin 添加到我的路径环境变量中。 尝试使用 HelloWorld 向导创建新的 C++ 项目时,出现构
我正在开发 CDT eclipse 插件,我正在尝试使用以下代码使用 CDT 代码获取 eclipse 项目资源管理器中存在的源文件列表,结果为空。 案例1: IFile[] files2 = Res
我是一名优秀的程序员,十分优秀!