在linux下用eclipse开发c++程序时出错,找不到include文件

bbhl80 2006-02-15 07:47:59
我用的是Red Hat Fedroa Core3+gtkmm+eclipse+CDT,装好了以后建立Managed C++ Project,文件如下
helloworld.h:
#ifndef GTKMM_EXAMPLE_HELLOWORLD_H
#define GTKMM_EXAMPLE_HELLOWORLD_H

#include <gtkmm/button.h>
#include <gtkmm/window.h>

class HelloWorld : public Gtk::Window
{

public:
HelloWorld();
virtual ~HelloWorld();

protected:
//Signal handlers:
virtual void on_button_clicked();

//Member widgets:
Gtk::Button m_button;
};

#endif // GTKMM_EXAMPLE_HELLOWORLD_H

helloworld.cxx:
#include "helloworld.h"
#include <iostream>

HelloWorld::HelloWorld()
: m_button("Hello World") // creates a new button with the label "Hello World".
{
// Sets the border width of the window.
set_border_width(10);

// When the button receives the "clicked" signal, it will call the
// on_button_clicked() method. The on_button_clicked() method is defined below.
m_button.signal_clicked().connect(sigc::mem_fun(*this, &HelloWorld::on_button_clicked));

// This packs the button into the Window (a container).
add(m_button);

// The final step is to display this newly created widget...
m_button.show();
}

HelloWorld::~HelloWorld()
{
}

void HelloWorld::on_button_clicked()
{
std::cout << "Hello World" << std::endl;
}

main.cxx:
#include <gtkmm/main.h>
#include "helloworld.h"

int main (int argc, char *argv[])
{
Gtk::Main kit(argc, argv);

HelloWorld helloworld;
Gtk::Main::run(helloworld); //Shows the window and returns when it is closed.

return 0;
}

编译的时候说找不到头文件gtkmm/main.h,gtkmm/button.h,gtkmm/window.h,但是可以找到<iostream>,这是为什么?
...全文
361 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
wshcdr 2006-02-16
  • 打赏
  • 举报
回复
会不会是没有安装GTK的SDK 包?
积木 2006-02-16
  • 打赏
  • 举报
回复
第一,可能没有安装sdk
第二,你的编译器没有指定include的编译参数。
什么是makefile?或许很多Windows的程序员都不知道这个东西,因为那些Windows 的IDE都为你做了这个工作,但我觉得要作一个好的和professional的程序员, makefile还是要懂。这就好像现在有这么多的HTML的编辑器,但如果你想成为一个专业 人士,你还是要了解HTML的标识的含义。特别在Unix下的软件编译,你就不能不自己写 makefile了,会不会写makefile,从一个侧面说明了一个人是否具备完成大型工程的能 力。 因为,makefile关系到了整个工程的编译规则。一个工程中的源文件不计数,其按类型、 功能、模块分别放在若干个目录中,makefile定义了一系列的规则来指定,哪些文件需要 先编译,哪些文件需要后编译,哪些文件需要重新编译,甚至于进行更复杂的功能操作,因 为makefile就像一个Shell脚本一样,其中也可以执行操作系统的命令。 makefile带来的好处就是——“自动化编译”,一旦写好,只需要一个make命令,整个工 程完全自动编译,极大的提高了软件开发的效率。make是一个命令工具,是一个解释 makefile中指令的命令工具,一般来说,大多数的IDE都有这个命令,比如:Delphi的 make,Visual C++的nmake,Linux下GNU的make。可见,makefile都成为了一种 在工程方面的编译方法。 现在讲述如何写makefile的文章比较少,这是我想写这篇文章的原因。当然,不同产商的 make各不相同,也有不同的语法,但其本质都是在“文件依赖性”上做文章,这里,我仅 对GNU的make进行讲述,我的环境是RedHat Linux 8.0,make的版本是3.80。必竟, 这个make是应用最为广泛的,也是用得最多的。而且其还是最遵循于IEEE 1003.2-1992 标准的(POSIX.2)。 在这篇文档中,将以C/C++的源码作为我们基础,所以必然涉及一些关于C/C++的编译的 知识,相关于这方面的内容,还请各位查看相关的编译器的文档。这里所默认的编译器是 UNIX下的GCC和CC。

24,860

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 工具平台和程序库
社区管理员
  • 工具平台和程序库社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧