Visual Studio 2013 中的C++ - <Class> 未定义
C++ in Visual Studio 2013 - <Class> is undefined
我对C++/VS很陌生,可能在我的项目的代码/配置中缺少一些东西。在我的解决方案中,我有两个项目:
- 第一个是我下载的NTLhttps://bitbucket.org/ben_key/ntl,并编译为静态库NTL.lib
- 一个"测试"项目,其中:(1)我通过在属性->C++->附加包含文件中指定其目录来添加头文件,(2)在属性->链接器->输入->附加依赖项中我添加了"NTL.lib"(3)将NTL.lib文件复制到与"测试"项目的主cpp文件相同的目录中
我的cpp只包含:
#include <NTL/GF2X.h>
int main() {
GF2X P;
return 1;
}
构建提供输出:
1>------ Build started: Project: test, Configuration: Release Win32 ------
1>C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V120Microsoft.CppBuild.targets(388,5): warning MSB8028: The intermediate directory (Release) contains files shared from another project (ntl-test.vcxproj). This can lead to incorrect clean and rebuild behavior.
1> QuickTest.cpp
1>..testsQuickTest.cpp(43): warning C4101: 'n' : unreferenced local variable
1>D:studiesThesisNTL-Ben-KeyIncludeNTL/vector.h(79): warning C4291: 'void *operator new(size_t,_ntl_vector_placement)' : no matching operator delete found; memory will not be freed if initialization throws an exception
1> D:studiesThesisNTL-Ben-KeyIncludeNTL/vector.h(36) : see declaration of 'operator new'
1> D:studiesThesisNTL-Ben-KeyIncludeNTL/vector.h(319) : see reference to function template instantiation 'void NTL::BlockConstruct<T>(T *,long)' being compiled
1> with
1> [
1> T=NTL::zz_p
1> ]
1> D:studiesThesisNTL-Ben-KeyIncludeNTL/vector.h(291) : while compiling class template member function 'void NTL::Vec<NTL::zz_p>::DoSetLength(long)'
1> D:studiesThesisNTL-Ben-KeyIncludeNTL/vector.h(115) : see reference to function template instantiation 'void NTL::Vec<NTL::zz_p>::DoSetLength(long)' being compiled
1> D:studiesThesisNTL-Ben-KeyIncludeNTL/vec_lzz_p.h(14) : see reference to class template instantiation 'NTL::Vec<NTL::zz_p>' being compiled
1> MyTest.cpp
1>MyTest.cpp(4): error C2065: 'GF2X' : undeclared identifier
1>MyTest.cpp(4): error C2146: syntax error : missing ';' before identifier 'P'
1>MyTest.cpp(4): error C2065: 'P' : undeclared identifier
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
这真的是一件简单的事情,我没有弄清楚我错过了什么。
来自NTL/include/NTL/tools.h:
#define NTL_NAMESPACE NTL
#define NTL_OPEN_NNS namespace NTL_NAMESPACE {
#define NTL_CLOSE_NNS }
因此,当预处理器遇到NTL_OPEN_NNS
时,就像包含文件GF2X.h中的情况一样,它将其扩展为namespace NTL
,这意味着GF2X类在名称空间NTL中声明。为了使用它,您需要将其完全限定为NTL::GF2X
,或者使用using namespace NTL
来讨论(例如)此处的哪一个。同样,在GF2X.h的末尾,在展开NTL_CLOSE_NNS 后有一个闭合括号
相关文章:
- 请解释这句话(cout<<1+int((a<b)^((b-a)&1) )<<endl
- 呼叫运营商<<临时
- 如何防止clang格式在流运算符调用之间添加换行符<<
- <<操作员在下面的行中工作
- EASTL矢量<向量<int>>连续的
- C - 创建矢量&lt; vector&lt; double&gt;&gt;矩阵具有分配而不是inizializ
- 为什么将此对向量&lt; map&lt; int,int&gt;&gt;中的地图进行更新.失败
- C :对矢量进行排序&lt; struct&gt;(结构有2个整数)基于结构的整数之一
- 明确的专业化“ CheckIntmap&lt;&gt;”实例化
- 什么是模板&lt;&gt;inline bla bla
- 编辑C Qlist&lt; object*&gt; gt;QML代码和一些QML警告中的模型
- eigen :: llt&lt;eigen :: matrixxd&gt;具有不完整的类型
- 错误,包括&lt; ctype&gt;在原子上使用C 11
- std::vector<;uint8_t>;当C++11/14启用时,手动复制而不是调用memcpy
- 如何加入向量&lt; int&gt;到C 中的单个INT
- 是std :: set&lt; std :: future&gt;不可能存在
- 是numeric_limits&lt; int&gt; :: is_modulo从逻辑上矛盾
- opencv 2.4.7在iOS错误背景_segm.hpp #include&lt; list&gt;未找到
- 在修改列表后,std :: list&lt; t&gt; :: end()的值是否会更改
- ///<评论></评论>在Visual Studio中