【发布时间】:2014-05-14 20:13:40
【问题描述】:
我正在尝试使用 FLTK 和 VC++2010 创建一个新项目。我有一段时间没有这样做了。我尽我所能通过记忆设置属性。我收到了一个链接器错误。谁能告诉我如何解决这个问题?
1>------ Build started: Project: BJST chap 14 ex 1a, Configuration: Debug Win32 ------
1> BJST chap 14 ex 1.cpp
1>c:\users\bryan\documents\visual studio 2010\projects\bjst chap 14 ex 1a\bjst chap 14 ex 1a\bjst chap 14 ex 1.cpp(10): error C2065: 'FL_Window' : undeclared identifier
1>c:\users\bryan\documents\visual studio 2010\projects\bjst chap 14 ex 1a\bjst chap 14 ex 1a\bjst chap 14 ex 1.cpp(10): error C2146: syntax error : missing ';' before identifier 'window'
1>c:\users\bryan\documents\visual studio 2010\projects\bjst chap 14 ex 1a\bjst chap 14 ex 1a\bjst chap 14 ex 1.cpp(10): error C3861: 'window': identifier not found
1>c:\users\bryan\documents\visual studio 2010\projects\bjst chap 14 ex 1a\bjst chap 14 ex 1a\bjst chap 14 ex 1.cpp(12): error C2065: 'FL_Box' : undeclared identifier
1>c:\users\bryan\documents\visual studio 2010\projects\bjst chap 14 ex 1a\bjst chap 14 ex 1a\bjst chap 14 ex 1.cpp(12): error C2146: syntax error : missing ';' before identifier 'box'
1>c:\users\bryan\documents\visual studio 2010\projects\bjst chap 14 ex 1a\bjst chap 14 ex 1a\bjst chap 14 ex 1.cpp(12): error C3861: 'box': identifier not found
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
#include <FL/Fl.H>
#include <FL/Fl_Box.H>
#include <FL/Fl_Window.H>
int main ()
{
FL_Window window(200, 200, "window title");
FL_Box box();
return 0;
}
【问题讨论】:
-
'缺少';'在标识符 'box'` 之前不是 linker 错误!
-
你忘记
#include <FLTK_header_name_goes_here.h>了吗?或者,FLTK 类型可能属于某个命名空间,您需要对它们进行限定。无论如何,这些都不是链接器错误。 -
我使用的是 box 和 window,你可以看到它们都包含在内。
-
可能错过了
namespace? -
知道了。 FL_Window 需要为 Fl_Window,以此类推。
标签: c++ visual-studio-2010 fltk