,   CyberForum.ru

++


 
kb1n3s
: n/a
#1

[Linker Error] Unresolved external '_main' referenced from C:\PROGRAM FILES (X86)\BORLAND\CBUILDER6\LIB\C0X32.OBJ - C++

16.05.2013, 19:13. 815. 1
( )

main()
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#include <cstring>
 
#define BASE 10 //ñèñòåì* ñ÷èñëå*èÿ
#define MIN_LENGTH_FOR_KARATSUBA 4 //÷èñë* êîðî÷å óì*îæ*þòñÿ êâ*äð*òè÷*ûì *ëãîðèòìîì
typedef int digit; //âçÿò òîëüêî äëÿ ð*çðÿäîâ ÷èñë*
typedef unsigned long int size_length; //òèï äëÿ äëè**û ÷èñë*
 
using namespace std;
 
 
struct long_value { //òèï äëÿ äëè**ûõ ÷èñåë
  digit *values; //ì*ññèâ ñ öèôð*ìè ÷èñë* ç*ïèñ***ûìè â îáð*ò*îì ïîðÿäêå
  size_length length; //äëè*** ÷èñë*
};
 
long_value sum(long_value a, long_value b) {
  /* ôó*êöèÿ äëÿ ñóììèðîâ**èÿ äâóõ äëè**ûõ ÷èñåë. Åñëè ñóììèðóþòñÿ ÷èñë* ð*ç*îé äëè**û
  * òî áîëåå äëè**îå ïåðåäåòñÿ â ê*÷åñòâå ïåðâîãî *ðãóìå*ò*. Âîçâð*ù*åò *îâîå
  * *å*îðì*ëèçîâ***îå ÷èñëî.
  */
  long_value s;
  s.length = a.length + 1;
  s.values = new digit[s.length];
 
  s.values[a.length - 1] = a.values[a.length - 1];
  s.values[a.length] = 0;
  for (size_length i = 0; i < b.length; ++i)
    s.values[i] = a.values[i] + b.values[i];
  return s;
}
 
long_value &sub(long_value &a, long_value b) {
  /*ôó*êöèÿ äëÿ âû÷èò**èÿ îä*îãî äëè**îãî ÷èñë* èç äðóãîãî. Èçìå*ÿåò ñîäåðæèìîå ïåðâîãî
  * ÷èñë*. Âîçâð*ù*åò ññûëêó ** ïåðâîå ÷èñëî. Ðåçóëüò*ò *å *îðì*ëèçîâ**.
  */
  for (size_length i = 0; i < b.length; ++i)
    a.values[i] -= b.values[i];
  return a;
}
 
void normalize(long_value l) {
  /*Íîðì*ëèç*öèÿ ÷èñë* - ïðèâåäå*èå ê*æäîãî ð*çðÿä* â ñîîòâåòñòâèå ñ ñèñòåìîé ñ÷èñëå*èÿ.
  *
  */
  for (size_length i = 0; i < l.length - 1; ++i) {
    if (l.values[i] >= BASE) { //åñëè ÷èñëî áîëüøå ì*êñèì*ëü*îãî, òî îðã**èçîâ*â*åòñÿ ïåðå*îñ
      digit carryover = l.values[i] / BASE;
      l.values[i + 1] += carryover;
      l.values[i] -= carryover * BASE;
    } else if (l.values[i] < 0) { //åñëè ìå*üøå - ç*åì
      digit carryover = (l.values[i] + 1) / BASE - 1;
      l.values[i + 1] += carryover;
      l.values[i] -= carryover * BASE;
    }
  }
}
 
long_value karatsuba(long_value a, long_value b) {
  long_value product; //ðåçóëüòèðóþùåå ïðîèçâåäå*èå
  product.length = a.length + b.length;
  product.values = new digit[product.length];
 
  if (a.length < MIN_LENGTH_FOR_KARATSUBA) { //åñëè ÷èñëî êîðî÷å òî ïðèìå*ÿòü **èâ*îå óì*îæå*èå
    memset(product.values, 0, sizeof(digit) * product.length);
    for (size_length i = 0; i < a.length; ++i)
      for (size_length j = 0; j < b.length; ++j) {
        product.values[i + j] += a.values[i] * b.values[j];
        /*Â ñëó÷*å èçìå*å*èÿ MIN_LENGTH_FOR_KARATSUBA èëè BASE ð*ññêîìå*òèðîâ*òü ñëåäóþùèå
        * ñòðîêè è ïîäîáð*òü ñîîòâ. ç**÷å*èÿ äëÿ èñêëþ÷å*èÿ ïåðåïîë*å*èÿ ð*çðÿäîâ.
        * Í*ïðèìåð äëÿ äåñÿòè÷*îé ñèñòåìû ñ÷èñëå*èÿ ÷èñëî 100, îç**÷*åò, ÷òî îðã**èçîâ*â*åòñÿ
        * ïåðå*îñ 1 ÷åðåç îäè* ð*çðÿä, 200 - ïåðå*îñ 2 ÷åðåç îäè* ð*çððÿä, 5000 - 5 ÷åðåç äâ*.
        * if (product.values[i + j] >= 100){
        *   product.values[i + j] -= 100;
        *   product.values[i + j + 2] += 1;
        * }
        */
      }
  } else { //óì*îæå*èå ìåòîäîì Ê*ð*öóáû
    long_value a_part1; //ìë*äø*ÿ ÷*ñòü ÷èñë* a
    a_part1.values = a.values;
    a_part1.length = (a.length + 1) / 2;
 
    long_value a_part2; //ñò*ðø*ÿ ÷*ñòü ÷èñë* a
    a_part2.values = a.values + a_part1.length;
    a_part2.length = a.length / 2;
 
    long_value b_part1; //ìë*äø*ÿ ÷*ñòü ÷èñë* b
    b_part1.values = b.values;
    b_part1.length = (b.length + 1) / 2;
 
    long_value b_part2; //ñò*ðø*ÿ ÷*ñòü ÷èñë* b
    b_part2.values = b.values + b_part1.length;
    b_part2.length = b.length / 2;
 
    long_value sum_of_a_parts = sum(a_part1, a_part2); //cóìì* ÷*ñòåé ÷èñë* a
    normalize(sum_of_a_parts);
    long_value sum_of_b_parts = sum(b_part1, b_part2); //cóìì* ÷*ñòåé ÷èñë* b
    normalize(sum_of_b_parts);
    long_value product_of_sums_of_parts = karatsuba(sum_of_a_parts, sum_of_b_parts);
    // ïðîèçâåäå*èå ñóìì ÷*ñòåé
 
    long_value product_of_first_parts = karatsuba(a_part1, b_part1); //ìë*äøèé ÷ëå*
    long_value product_of_second_parts = karatsuba(a_part2, b_part2); //ñò*ðøèé ÷ëå*
    long_value sum_of_middle_terms = sub(sub(product_of_sums_of_parts, product_of_first_parts), product_of_second_parts);
    //**õîæäå*èå ñóììû ñðåä*èõ ÷ëå*îâ
 
    /*
    * Ñóììèðîâ**èå ì*îãî÷ëå**
    */
    memcpy(product.values, product_of_first_parts.values,
      product_of_first_parts.length * sizeof(digit));
    memcpy(product.values + product_of_first_parts.length,
      product_of_second_parts.values, product_of_second_parts.length
      * sizeof(digit));
    for (size_length i = 0; i < sum_of_middle_terms.length; ++i)
      product.values[a_part1.length + i] += sum_of_middle_terms.values[i];
 
    /*
    * Ç*÷èñòê*
    */
    delete [] sum_of_a_parts.values;
    delete [] sum_of_b_parts.values;
    delete [] product_of_sums_of_parts.values;
    delete [] product_of_first_parts.values;
    delete [] product_of_second_parts.values;
  }
 
  normalize(product); //êî*å÷**ÿ *îðì*ëèç*öèÿ ÷èñë*
 
  return product;
}
Similar
41792 / 34177 / 6122
: 12.04.2006
: 57,940
16.05.2013, 19:13     [Linker Error] Unresolved external '_main' referenced from C:\PROGRAM FILES (X86)\BORLAND\CBUILDER6\LIB\C0X32.OBJ
:

Error LNK2001: "unresolved external symbol _main" C++
unresolved external symbol _main C++
[Linker Error] Unresolved external '_main' referenced from C:\PROGRAM FILES\BORLAND\CBUILDER6\LIB\C0X32.OBJ C++
C++ main.obj : error LNK2019: unresolved external symbol
[Linker Error] Unresolved external '_Form1' C++
C++ : Unresolved external '_main' referensed from d:c5libcox32.obj
C++ [Linker Error] Unresolved external 'Sort(int, int)' referenced from H:\INFORMATIC\5\UNIT1.OBJ
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16 C++
Unresolved external symbol main referenced in function __tmainCRTStartup C++
Unresolved external symbol _SnmpListen@8 referenced in function _main C++
C++ [Linker Error] Unresolved external '_main' referenced
Linker Error: unresolved external MyArray C++



:
.
Croessmah
 C ++
   Croessmah
12535 / 7097 / 797
: 27.09.2012
: 17,510
: 2
: 1
17.05.2013, 04:41     [Linker Error] Unresolved external '_main' referenced from C:\PROGRAM FILES (X86)\BORLAND\CBUILDER6\LIB\C0X32.OBJ #2
main?
Yandex
17.05.2013, 04:41     [Linker Error] Unresolved external '_main' referenced from C:\PROGRAM FILES (X86)\BORLAND\CBUILDER6\LIB\C0X32.OBJ

: 13:08. GMT +3.
- , ,
-
Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
@Mail.ru