V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  borischenc  ›  全部回复第 3 页 / 共 3 页
回复总数  49
1  2  3  
2017-03-29 21:09:39 +08:00
回复了 borischenc 创建的主题 Python Python 编辑 Mac 可执行文件 py2app 可以创建 console application 吗?
@Kilerd 请问要怎么打包进去呢?
2017-03-29 20:46:58 +08:00
回复了 borischenc 创建的主题 Python Python 编辑 Mac 可执行文件 py2app 可以创建 console application 吗?
@konia
pyinstaller 编译出来的文件执行的时候会说 ImportError: No module named 'queue'
不是很清楚为什么
使用的 python3.5 编写的程序
2017-01-19 14:39:07 +08:00
回复了 borischenc 创建的主题 C [c++新手问题] redefinition of default argument 报错应该如何解决
@nifury 嗯嗯解决了!!谢谢!!
2017-01-19 14:23:03 +08:00
回复了 deweixu 创建的主题 程序员 你们公司是如何做 KPI 考核的?或者有 KPI 考核吗?
@deweixu 你们的考核是啥样的?
2017-01-19 14:22:06 +08:00
回复了 borischenc 创建的主题 C [c++新手问题] redefinition of default argument 报错应该如何解决
@nifury 因为头文件里面有

#ifndef binary_tree_hpp
#define binary_tree_hpp

所以照理来说是不会出现重复包含的情况的。
2017-01-19 13:52:05 +08:00
回复了 borischenc 创建的主题 C [c++新手问题] redefinition of default argument 报错应该如何解决
duplicate symbol _root in:
/Users/Boris/Library/Developer/Xcode/DerivedData/Algorithems_ToolBox-duheuacdjorkbdensozspjevuypq/Build/Intermediates/Algorithems ToolBox.build/Debug/Algorithems ToolBox.build/Objects-normal/x86_64/binary_tree.o
/Users/Boris/Library/Developer/Xcode/DerivedData/Algorithems_ToolBox-duheuacdjorkbdensozspjevuypq/Build/Intermediates/Algorithems ToolBox.build/Debug/Algorithems ToolBox.build/Objects-normal/x86_64/main.o

这个是 main.cpp 的代码:

#include <iostream>
#include "binary_tree.hpp"

int main(){
print_tree();
}

这个是 binary_tree.hpp 的代码,我觉得并没有重复申明 root 变量啊,只在头文件里面生成了。

#include "binary_tree.hpp"
using namespace std;

Node* get_min(Node* node){
if (node->left)
return get_min(node->left);
return node;
}

Node* add(int key, int value){
Node* node;
node->key = key;
node->value = value;
return add(node);
}

Node* add(Node * node){
Node* current_node = root;
while(1){
if (!current_node) {
current_node = node;
return current_node;
}
if (node->key == current_node->key) {
return current_node;
}
else if (node->key > current_node->key){
current_node = current_node->right;
}
else{
current_node = current_node-> left;
}
}


}

string print_tree(stack<Node*, vector<Node*>> nodes){
cout<<nodes.top()<<endl<<root<<endl;
return "";
}
2017-01-19 13:50:44 +08:00
回复了 borischenc 创建的主题 C [c++新手问题] redefinition of default argument 报错应该如何解决
@zonyitoo
@lazyhare
@fgcmaster

谢谢大家的帮助,我现在把代码修改了一下,把 extern 关键字去掉了, default argument 也只在函数的头文件里面定义了。但是出现了另一个报错,说
2017-01-19 04:10:16 +08:00
回复了 borischenc 创建的主题 C [c++新手问题] redefinition of default argument 报错应该如何解决
@Valyrian 还是会报错,

Undefined symbols for architecture x86_64:
"print_tree()", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
2017-01-19 04:02:51 +08:00
回复了 borischenc 创建的主题 C [c++新手问题] redefinition of default argument 报错应该如何解决
@Valyrian 如果去掉的话在没有参数对函数进行调用的时候,如`print_tree();`则会显示 No matching function for call to 'private tree'
1  2  3  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   896 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 15ms · UTC 19:29 · PVG 03:29 · LAX 12:29 · JFK 15:29
Developed with CodeLauncher
♥ Do have faith in what you're doing.