小编Zet*_*eta的帖子

c ++编译失败并出现错误:命名空间'std'中没有名为'snprintf'的成员

它可以在几分钟前成功编译.在我尝试通过按"配置文件"按钮构建项目之后出现了问题.之后,我的项目无法再编译.

错误消息是:

In file included from /Users/wangyj1203/workspace/project_x/svn/src/c++/src/latte/latte_prefix.h:24:
In file included from /Users/wangyj1203/workspace/project_x/svn/src/c++/src/latte/../../../../../../../../../usr/include/c++/4.2.1/iostream:44:
In file included from /Users/wangyj1203/workspace/project_x/svn/src/c++/src/latte/../../../../../../../../../usr/include/c++/4.2.1/ostream:44:
In file included from /Users/wangyj1203/workspace/project_x/svn/src/c++/src/latte/../../../../../../../../../usr/include/c++/4.2.1/ios:42:
In file included from /Users/wangyj1203/workspace/project_x/svn/src/c++/src/latte/../../../../../../../../../usr/include/c++/4.2.1/iosfwd:44:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include/c++/4.2.1/bits/c++locale.h:48:
In file included from /Users/wangyj1203/workspace/project_x/svn/src/c++/src/latte/../../../../../../../../../usr/include/c++/4.2.1/cstdio:52:
In file included from /Users/wangyj1203/workspace/project_x/svn/src/c++/src/latte/../../../../../../../../../usr/include/c++/4.2.1/tr1/stdio.h:37:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include/c++/4.2.1/tr1/cstdio:46:14: error: no member named 'snprintf' in namespace 'std'
  using std::snprintf;
        ~~~~~^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include/c++/4.2.1/tr1/cstdio:47:14: error: no member named 'vsnprintf' in namespace 'std'
  using std::vsnprintf;
        ~~~~~^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include/c++/4.2.1/tr1/cstdio:49:14: error: no member named 'vfscanf' in namespace 'std'
  using std::vfscanf;
        ~~~~~^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include/c++/4.2.1/tr1/cstdio:50:14: error: …

c++ xcode stl

6
推荐指数
1
解决办法
1万
查看次数

如何拆分大文件?

我有一个大的CSV文件(7.3GB; 16,300,000行),我该如何将这个文件分成两个文件?

linux

6
推荐指数
1
解决办法
9827
查看次数

memory_order_seq_cst 如何与非原子操作同步?

如果使用单个原子变量 and std::memory_order_seq_cst,是否保证非原子操作不会被重新排序?

例如,如果我有

std::atomic<bool> quux = {false};

void foo() {
    bar();
    quux.store(true, std::memory_order_seq_cst);
    moo();
}
Run Code Online (Sandbox Code Playgroud)

bar()保证不会得到调用后重新排序store,而moo()不是得到的调用之前重新排序store,只要我使用std::memory_order_seq_cst来自另一个线程的角度看,至少有?

或者,把它放在代码中,如果从另一个线程运行,以下假设是否有效?

if(quux.load(std::memory_order_seq_cst) == true) {
   // bar guaranteed to be called; its side-effects are visible
   // moo might have been called, but is not guaranteed to
} else {
   // bar might have been called, but is not guaranteed to
   // moo might have been called, but is not guaranteed to
} …
Run Code Online (Sandbox Code Playgroud)

c++ multithreading synchronization atomic

6
推荐指数
1
解决办法
785
查看次数

为什么两个游标同时在嵌入式应用程序中运行和移动?

我使用的是qt-embedded 4.7.1.我能够在主机上交叉编译框架以定位Beagleboard机器,但是当我在此目标上部署并运行演示应用程序时,我看到两个游标同时运行,一个用于目标操作系统,另一个用于目标操作系统执行qt应用程序.

换句话说,我只能用自己的光标与qt app进行通信,而没有原始光标 - 在运行该应用程序之前?我使用QWS作为qt应用程序,因为我使用此命令"target $./ demoapp -qws"在目标上运行演示应用程序.

c++ user-interface qt beagleboard

5
推荐指数
1
解决办法
520
查看次数

在Haskell中导出函数

我有一个名为A.hs的haskell文件.我有很多辅助函数,但我只想导出其中两个,例如foo1和foo2.这是语法核心吗?

module A (foo1,foo2) where

foo1 a b = a * b
foo2 a b = a + b
Run Code Online (Sandbox Code Playgroud)

由于我的文件中还有其他辅助函数,所以我不应该在执行此操作后从前奏中找到它们,对吧?但我可以联系到他们.我不知道该怎么做.我怎么解决这个问题?

提前致谢.

haskell module export

5
推荐指数
1
解决办法
464
查看次数

如何隐藏optgroup标签?

我需要去掉 optgroups 中的标签。

从这里:http : //i.stack.imgur.com/Gn5e5.png

成这个:http : //i.stack.imgur.com/ZvRM7.png

但我需要用 opgroups 来做到这一点。我不想删除它们。

<select>
  <optgroup>
    <option>1</option>
  </optgroup>
  <optgroup>
    <option>2</option>
  </optgroup>
  <optgroup>
    <option>3</option>
  </optgroup>
  <optgroup>
    <option>4</option>
  </optgroup>
</select>
Run Code Online (Sandbox Code Playgroud)

jsfiddle:http : //jsfiddle.net/upXn8/

html html-select optgroup

5
推荐指数
1
解决办法
1万
查看次数

作为 Data.Map 值的异构类型

我希望能够做这样的事情,这显然是不允许的。

import qualified Data.Map as Map
x = Map.fromList [ 
      ("Name",    ["John", "Steve", "Kelly", "Zoe"]), 
      ("Surname", ["Smith", "Lee", "Ng", "White"]), 
      ("Age",     [1, 2, 3, 4]) 
    ]
Run Code Online (Sandbox Code Playgroud)

一种可能的解决方案是创建这样的类型:

data L = LInt [Int] | LString [String]

x = Map.fromList [ 
      ("Name",    LString ["John", "Steve", "Kelly", "Zoe"]),
      ("Surname", LString ["Smith", "Lee", "Ng", "White"]), 
      ("Age",     LInt    [1, 2, 3, 4]) 
    ]
Run Code Online (Sandbox Code Playgroud)

这是不可取的。有没有更好的方法?

我的实际用例:非常广泛,我正在尝试实现 dplyr ( http://cran.r-project.org/web/packages/dplyr/vignettes/introduction.html ) 的一部分,可以将其视为“语法数据的”。Dplyr 具有用于表格数据的列和行选择以及行的分组和连接的表达式,其中行数可以是数百万,列数可以是数百。我现在关心的不是数据大小,而是生成与该包类似的功能和工作流程的能力

haskell map

5
推荐指数
1
解决办法
349
查看次数

将char指针数组传递给C中的函数?

我有以下代码:

int main(){
    char **array;
    char a[5];
    int n = 5;

    array = malloc(n *sizeof *array);

    /*Some code to assign array values*/

    test(a, array);

    return 0;
}

int test(char s1, char **s2){
    if(strcmp(s1, s2[0]) != 0)
        return 1;

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

我正在尝试将char和char指针数组传递给函数,但上面的代码会导致以下错误和警告:

temp.c: In function ‘main’:
temp.c:6:5: warning: implicit declaration of function ‘malloc’ [-Wimplicit-function-declaration]
temp.c:6:13: warning: incompatible implicit declaration of built-in function ‘malloc’ [enabled by default]
temp.c:10:5: warning: implicit declaration of function ‘test’ [-Wimplicit-function-declaration]
temp.c: At top level:
temp.c:15:5: error: …

c arrays pointers char

4
推荐指数
1
解决办法
7934
查看次数

垂直对齐中间文本没有lineheight和table-cell

我有一个带有"toggle"-Animation的预告片,可以在JSFiddle或下面看到:

.ax {
    height:60px;
    width:150px;
    background:gold;
}
 .caption {
position: absolute;
    left:0;
  top: 35%;
  overflow: hidden;
  right: 0;
  background-color: rgba(24,88,140,0.7);
  width: 100%;
  height: 52px;
  z-index: 2;
  -o-transition: 500ms;
  -webkit-transition: 500ms;
  -moz-transition: 500ms;
  -ms-transition: 500ms;
  transition: 500ms;
  font-weight: lighter;
  padding: 10px;
  color: #fff;
}

a.link{
  color: #fff;
  overflow: hidden;
  width: 80%;
  margin-bottom: 30px;
  font-weight: lighter;
  font-size: 16px;
  line-height: 22px;
}

 .caption:hover {
  height: 100%;
  top: 0;
}
.box {
    position:relative;    
    width:250px;
    height:200px;
}

/*TABLE CELL METHOD*/

 .caption2 {
     position: …
Run Code Online (Sandbox Code Playgroud)

css vertical-alignment

4
推荐指数
2
解决办法
1万
查看次数

为什么(.)头的类型((a - > [c]) - > a - > c)?

我试过:t (.) headGHCi并得到结果(a -> [c]) -> a -> c 我对此非常困惑.有人能给我一个提示来帮助我理解这一点吗?

对于我自己的想法,结果应该是 ([a] -> a -> c)-> a -> c

haskell

4
推荐指数
1
解决办法
112
查看次数