- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 Visual Studio 2012 中创建了一个新的 Visual C++ Win32 项目 - 只是一个带有预编译 header 的控制台应用程序。我为 atltime.h
添加了一个 include 并向 _tmain
添加了三行代码:
// timeapp2.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "atltime.h"
int _tmain(int argc, _TCHAR* argv[])
{
CTime c = CTime::GetCurrentTime();
DBTIMESTAMP t;
c.GetAsDBTIMESTAMP(t);
return 0;
}
我编译它。它编译得很好。
我在 Visual Studio 2013 中尝试同样的操作。我收到以下错误:
Error 1 error LNK2019: unresolved external symbol "public: bool __thiscall ATL::CTime::GetAsDBTIMESTAMP(struct tagDBTIMESTAMP &)const " (?GetAsDBTIMESTAMP@CTime@ATL@@QBE_NAAUtagDBTIMESTAMP@@@Z) referenced in function _wmain c:\tmp\timeapp\timeapp2\timeapp2.obj timeapp2
Error 2 error LNK1120: 1 unresolved externals c:\tmp\timeapp\Debug\timeapp2.exe 1 1 timeapp2
这是从 MSDN 订阅者下载中获取的 Visual Studio Premium 2013 Update 2 的全新安装。我在两台不同的机器上尝试过同样的事情,一台运行 Windows 8.1 x64,另一台运行 Windows Server 2012 R2。两者都无法使用 Visual Studio 2013 进行编译。
我做错了什么?
最佳答案
您缺少 ATL 库。
(以下是针对 VS2008 的,对我的旧环境感到抱歉 - 但我希望您可以在类似的位置找到这些选项):
创建项目时,选择“添加通用ATL header ”
或者在 Project Configuratrion/General 下,启用“使用 ATL”(静态或动态,动态提供较小的可执行文件,但您需要 list 中的相应 ATL 运行时并安装在目标上)
[编辑]
您可以尝试将相应的 ATL 库手动添加到链接器(atl{s}{d}.lib,使用 's' 表示静态,'d' 表示调试版本)。还没有在 VS2013 下完成 ATL,所以这些只是“有根据的猜测”。
如果只是这一次调用,您也可以只使用GetSystemTime,然后填充DBTIMESTAMP 结构。
(无耻的插件:或者,如果您来自 CTime,它只是 _time64_t see here 的包装器,用于转换时间_t --> SYSTEMTIME)
关于c++ - 为什么我不能使用 Visual Studio 2013 调用 CTime::GetAsDBTIMESTAMP?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24410459/
我对 glibc ctime() 的工作原理有疑问。 按照我的代码片段: #include #include #include int main (int argc,char*
当我使用“ctime”时,curTime 和 pastTime 得到相同的字符串结果,即使 curTime 和 pastTime 的实际值相差 600 秒。 使用 ctime 时如何为两者获得相同的字
我有这个unix时间戳,使用ctime转换后显示为Thu Mar 26 15:30:26 2007,但我只需要Thu Mar 26 2007。 如何更改或截断以消除时间 (HH:MM:SS)? 最佳答
我在文本文件中插入时间时遇到问题。我使用以下代码得到 |21,43,1,3,10,5| Wed Feb 01 20:42:32 2012 这是正常的,但我想做的是将时间放在数字之前,例如 Wed Fe
我已将 ctime 值转换为 unicode 1295478503.6789999到'2011 年 1 月 19 日星期三 18:08:23' 我可以倒退吗?从第二行到第一行? 最佳答案 您需要 Py
ctime()函数应该给出自 Epoch 以来传入的秒数的字符串格式时间。这是我的代码: #include #include #include int main(int argc, int **arg
#include #include #include using namespace std; #define WIDTH 118 #define HEIGHT 60 void clearScr
我在将 ctime 字符串转换为 %Y-%m-%d 格式时遇到问题。 fileobject = "C:\\foo\\bar.txt" filetime = time.ctime(os.path.get
你好, 我有以下代码: int main () { time_t rawtime; time ( &rawtime ); printf ( "The current local time
我正在尝试更改我的 unix 时间戳的格式。但我没有看到任何自定义格式的选项。 这是我的代码: tempstring = "Your last login was: "; time_t lastLog
我正在使用 ctime。但是它总是返回 NULL。所以它以 sprintf 行为核心。它工作得更早。所以不确定为什么会随机返回 NULL? 我有以下代码片段: int main() { cha
如果用户类型time_t定义为__darwin_time_t,在MacOS X中它本身定义为long,为什么会出现下面的代码输出8 时间是(null)?也许这很愚蠢,但我真的无法理解。 #includ
我正在使用 ctime。但是它总是返回空值。所以它以 sprintf 线为核心。它工作得更早。所以不确定为什么它会随机返回 null。 我有以下代码片段: int main() { char avp
这是代码: void i_log_ (int error, const char * file, int line, const char * fmt, ...) { /* Get erro
标准 C ctime 函数是否返回公历日期?特别是,我想验证它是否会考虑闰年,从而显示相应日期的 Feb 29。 最佳答案 对于 future 和最近的时间,是的。对于公历改革之前的时间...我不知道
我有这样一个函数: void ft_display_time(struct timespec ttime) { char *time_long; time_long = cti
我试图让一个循环在 executionTime 指定的准确时间执行。我正在使用 ctime 来获得这个时间,我需要它在几毫秒的精度内(我相信它是)。一旦该循环运行了指定的执行时间,它就会中断。 我的问
我正在寻找 的 C++11 版本图书馆。 C++11 中有这样的东西吗? 编辑:任何具有更多功能的东西都是完美的! 编辑 2:我希望将其与我正在制作的游戏一起使用,以便我可以跟踪玩的总时间。我正在寻
我正在使用 ctime函数来获取 time_t 变量的可读表示。 ctime声明如下: char *ctime (const time_t *timer); 你可以看到它返回了一个指向结果 char
linux下的find命令在目录结构中搜索文件,并执行指定的操作。linux下的find命令提供了相当多的查找条件,功能很强大,由于find的功能很强大,所以他的选项也很多,今天我们来细说一下fin
我是一名优秀的程序员,十分优秀!