小编pon*_*ver的帖子

c ++使用声明和函数重载

  1 #include <iostream>
  2 
  3 namespace primerlib {
  4     void compute() { std::cout << "primerlib::print()" << std:: endl; }
  5     void compute(const void *p) { std::cout << "primerlib::print(const void *p)" << std:: endl; }
  6 }
  7 
  8 //using primerlib::compute;
  9 //using namespace primerlib;
 10 void compute(int a) { std::cout << "::compute(int)" << std:: endl; }
 11 void compute(double d, double dd=3.4) { std::cout << "primerlib::compute(d, d)" << std:: endl; }
 12 void compute(char* p, char* p1 = 0) { …
Run Code Online (Sandbox Code Playgroud)

c++

8
推荐指数
1
解决办法
1002
查看次数

Nginx Keepalive的默认值

在nginx.org中,keepalive config的默认值为-,但是我不太明白这是什么意思。

Syntax: keepalive connections;
Default:    —
Context:    upstream
This directive appeared in version 1.1.4.
Run Code Online (Sandbox Code Playgroud)

nginx

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

C++ 内联导致未定义的引用

#ifndef __T_H__
#define __T_H__

class A
{
    int j;
public:
    A(int i); 
};

#endif
Run Code Online (Sandbox Code Playgroud)

t.cpp

#include "t.h"

inline A::A(int i):j(i){}
Run Code Online (Sandbox Code Playgroud)

主程序

#include "t.h"

int main(void)
{
    A a(2);

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

编译:

$ g++ t.cpp main.cpp -o main
/tmp/ccRjri7I.o: In function `main':
main.cpp:(.text+0x15): undefined reference to `A::A(int)'
collect2: error: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)

如果我从实现中删除内联,就可以了。不知道为什么会这样。

c++

3
推荐指数
1
解决办法
1233
查看次数

标签 统计

c++ ×2

nginx ×1