0
我有一個長期項目,包括建立一個可以產生新穎的音樂和聲的專家系統。我從VB.net開始接受了這個項目,但希望使用獨立於平臺的語言,所以我轉而使用C++來促進未來的遷移。本質上,音調是當分組爲向量時形成的和絃進行的一部分,當分組爲向量形成塊的一部分時,等等。因此整個結構對它有遞歸的感覺。雖然下面的代碼會在Netbeans 7.2中進行編譯和鏈接,但是我遇到了很難解決的可怕內存問題,所以我現在正在使用Eclipse。雖然動態庫將在Eclipse中編譯,但似乎將總體級別的問題鏈接起來,以避免創建對象。我花了幾天的時間嘗試各種補救措施。我在這裏包含頂級主代碼和我收到的錯誤消息的部分列表。任何指針可能會發生什麼,將不勝感激。 THX在期待..鏈接器不構建用戶定義的類型
/*
* File: main.cpp
* Author: Creative
*
* Created on August 6, 2012, 10:49 AM
*/
#include "../tonestatdynlib/name_pitchstructure.h"
#include "../sequencerdynlib/chord.h"
#include "../sequencerdynlib/Move.h"
#include "../sequencerdynlib/block.h"
#include "../sequencerdynlib/prog.h"
#include "../legalitydynlib/testLegal.h"
#include "../dataWriterdynlib/dWriter.h"
#include <iostream>
#include <sqlite3.h>//database facility
int main(int argc, char** argv) {
int make;
char start;
cout << "Do you want to start a new movement? Y/N" << endl;
cin >> start;
if (start == 'Y') {
bool end = false;
Move theMove;
block theBlock;
prog theProg;
int i = 1, mv = 1, bk = 1, pr = 1;
theMove.items.push_back(theBlock);
theBlock.items.push_back(theProg);
do {
chord nextChord(i);
nextChord.getPitches();
theProg.items.push_back(nextChord);
dWriter dW(nextChord, pr, bk, mv, "SONO");
cout << "Chord Number " << i << " is completed. Do you want to:" << endl;
cout << "Enter another chord?: 1" << endl;
cout << "Start a new progression?: 2" << endl;
cout << "Start a new block?: 3" << endl;
cout << "Start a new movement?: 4" << endl;
cout << "Exit SONO: 5" << endl;
cin >> make;
switch (make) {
case 5: end = true;
break;
case 1: i++;
break;
case 2: i = 1;
pr++;
break;
case 3: i = 1;
pr = 1;
bk++;
break;
case 4: i = 1;
pr = 1;
bk = 1;
mv++;
break;
}
} while (end == false);
}
return 0;
}
錯誤消息:
g++ -L"/Users/Creative/Documents/workspace/tonestatdynlib/Debug" -L"/Users/Creative/Documents/workspace/chordOpsdynlib/Debug" -L"/Users/Creative/Documents/workspace/dataWriterdynlib/Debug" -L"/Users/Creative/Documents/workspace/legalitydynlib/Debug" -L"/Users/Creative/Documents/workspace/sequencerdynlib/Debug" -L"/Users/Creative/Documents/workspace/tonestatdynlib" -L"/Users/Creative/Documents/workspace/sequencerdynlib" -L"/Users/Creative/Documents/workspace/legalitydynlib" -L"/Users/Creative/Documents/workspace/dataWriterdynlib" -L"/Users/Creative/Documents/workspace/chordOpsdynlib" -o "SONO" ./main.o
Undefined symbols for architecture x86_64:
"block::block(block const&)", referenced from:
__gnu_cxx::new_allocator<block>::construct(block*, block const&)in main.o
void std::_Construct<block, block>(block*, block const&)in main.o
std::vector<block, std::allocator<block> >::_M_insert_aux(__gnu_cxx::__normal_iterator<block*, std::vector<block, std::allocator<block> > >, block const&)in main.o
"prog::prog(prog const&)", referenced from:
void std::_Construct<prog, prog>(prog*, prog const&)in main.o
__gnu_cxx::new_allocator<prog>::construct(prog*, prog const&)in main.o
std::vector<prog, std::allocator<prog> >::_M_insert_aux(__gnu_cxx::__normal_iterator<prog*, std::vector<prog, std::allocator<prog> > >, prog const&)in main.o
"chord::chord(chord const&)", referenced from:
void std::_Construct<chord, chord>(chord*, chord const&)in main.o
__gnu_cxx::new_allocator<chord>::construct(chord*, chord const&)in main.o
std::vector<chord, std::allocator<chord> >::_M_insert_aux(__gnu_cxx::__normal_iterator<chord*, std::vector<chord, std::allocator<chord> > >, chord const&)in main.o
"pitchStats::pitchStats(pitchStats const&)", referenced from:
void std::_Construct<pitchStats, pitchStats>(pitchStats*, pitchStats const&)in main.o
"block::~block()", referenced from:
_main in main.o
std::vector<block, std::allocator<block> >::_M_insert_aux(__gnu_cxx::__normal_iterator<block*, std::vector<block, std::allocator<block> > >, block const&)in main.o
"prog::~prog()", referenced from:
_main in main.o
std::vector<prog, std::allocator<prog> >::_M_insert_aux(__gnu_cxx::__normal_iterator<prog*, std::vector<prog, std::allocator<prog> > >, prog const&)in main.o
"chord::~chord()", referenced from:
_main in main.o
std::vector<chord, std::allocator<chord> >::_M_insert_aux(__gnu_cxx::__normal_iterator<chord*, std::vector<chord, std::allocator<chord> > >, chord const&)in main.o
"Move::Move()", referenced from:
_main in main.o
"block::block()", referenced from:
_main in main.o
"prog::prog()", referenced from:
_main in main.o
"chord::chord(int)", referenced from:
_main in main.o
"chord::getPitches()", referenced from:
_main in main.o
"dWriter::dWriter(chord const&, int, int, int, char const*)", referenced from:
_main in main.o
"dWriter::~dWriter()", referenced from:
_main in main.o
"Move::~Move()", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [SONO] Error 1
有關此事的重要說明:庫應放置_after_目標文件。 –
感謝4年YR回覆juanchopanza排序的問題! – Kam
@Kam很好!如果問題得到解決,您可以點擊勾號圖標接受答案。 – juanchopanza