【发布时间】:2014-03-18 17:28:02
【问题描述】:
所以我正在使用分支定界算法来实现 KnapSack 问题。我已经完成了它的实现,但是我遇到了一些奇怪的编译错误,我不知道如何解决:
编译错误
gcc -Wall -pedantic -g -std=c99 -c -o bnb.o bnb.c
bnb.c: In function ‘branch_and_bound’:
bnb.c:225: warning: cast from pointer to integer of different size
bnb.c:229: warning: implicit declaration of function ‘copy_string’
bnb.c:248: warning: cast from pointer to integer of different size
bnb.c:251: error: ‘struc_sol’ has no member named ‘string’
bnb.c:260: error: ‘struc_sol’ has no member named ‘string’
bnb.c:260: warning: cast from pointer to integer of different size
bnb.c:263: error: ‘struc_sol’ has no member named ‘string’
make: *** [bnb.o] Error 1
关于我做错了什么有什么建议吗?
【问题讨论】:
-
哪个错误信息你不明白?
-
请提供一个最小的例子。我不倾向于通过 300 多行代码
-
对每个单独的错误进行简短的 Google 搜索应该可以让您大致了解问题所在以及需要解决的问题。如果您在理解特定问题时遇到问题,请删除部分代码,直到只剩下该错误,然后将其发布在问题中。
标签: c algorithm compilation compiler-errors knapsack-problem