我收到一个链接器错误,我不理解 VC++ 和 FLTK

I'm getting a linker error I don't understand with VC++ and FLTK

本文关键字:错误 不理解 VC++ FLTK 一个 链接      更新时间:2023-10-16

我正在尝试用FLTK和vc++ 2010创建一个新项目。我有段时间没这么做了。我尽可能地根据记忆设置属性。我得到一个链接错误。谁能告诉我怎么解决这个问题?

1>------ Build started: Project: BJST chap 14 ex 1a, Configuration: Debug Win32 ------ 
1>  BJST chap 14 ex 1.cpp 
1>c:usersbryandocumentsvisual studio 2010projectsbjst chap 14 ex 1abjst chap 14 ex 1abjst chap 14 ex 1.cpp(10): error C2065: 'FL_Window' : undeclared identifier
1>c:usersbryandocumentsvisual studio 2010projectsbjst chap 14 ex 1abjst chap 14 ex 1abjst chap 14 ex 1.cpp(10): error C2146: syntax error : missing ';' before identifier 'window'
1>c:usersbryandocumentsvisual studio 2010projectsbjst chap 14 ex 1abjst chap 14 ex 1abjst chap 14 ex 1.cpp(10): error C3861: 'window': identifier not found
1>c:usersbryandocumentsvisual studio 2010projectsbjst chap 14 ex 1abjst chap 14 ex 1abjst chap 14 ex 1.cpp(12): error C2065: 'FL_Box' : undeclared identifier 
1>c:usersbryandocumentsvisual studio 2010projectsbjst chap 14 ex 1abjst chap 14 ex 1abjst chap 14 ex 1.cpp(12): error C2146: syntax error : missing ';' before identifier 'box'
1>c:usersbryandocumentsvisual studio 2010projectsbjst chap 14 ex 1abjst chap 14 ex 1abjst 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;
}

此错误信息

错误C2065: 'FL_Window':未声明的标识符

表示编译器没有找到标识符FL_Window的声明。只要输入正确,这个名称就有可能(我认为确实如此)在某个名称空间中声明。检查头文件<FL/Fl_Window.H>是否在某个命名空间中声明了这个名称。在这种情况下,你至少要写为

TheNameSpace::FL_Window window(200, 200, "window title");

where代替TheNameSpace,写名称FL_Window所在的命名空间

标识符FL_Box

似乎也存在同样的问题