VS2017在使用VS2015编译的libcurl静态库时报错

VS2017在使用VS2015编译的libcurl静态库时报错,错误信息如下:

1>libcurld.lib(cookie.obj) : error LNK2019: unresolved external symbol ___iob_func referenced in function _Curl_cookie_init

1>libcurld.lib(url.obj) : error LNK2001: unresolved external symbol ___iob_func

1>libcurld.lib(mprintf.obj) : error LNK2001: unresolved external symbol ___iob_func

1>libcurld.lib(formdata.obj) : error LNK2001: unresolved external symbol ___iob_func

1> fatal error LNK1120: 1 unresolved externals


解决方案:

在stdafx.h中增加如下 代码:

FILE _iob[] = { *stdin, *stdout, *stderr };
extern "C" FILE * __cdecl __iob_func(void) { return _iob; }

再重新编译即可通过。

sql server游标

sql server游标的使用示例代码:

declare test_cursor cursor for
select  t1.baijiahao as bjh_name, t1.baijiahao_home_url as home_url, t2.category_name as domain from baijia_articles t1
inner join category t2
on t1.cat_id = t2.id
open test_cursor
declare @bjh_name nvarchar(50)
declare @home_url nvarchar(90)
declare @domain nvarchar(50)
fetch next from test_cursor into @bjh_name, @home_url, @domain
while @@fetch_status=0
begin
       
       if not exists ( select id from baijiahao where bjh_name=@bjh_name)  insert into baijiahao(bjh_name, home_url, domain) values(@bjh_name, @home_url, @domain)
       fetch next from test_cursor into @bjh_name, @home_url, @domain
end
close test_cursor
deallocate test_cursor