我有一个长期项目正在进行中,其中涉及构建一个可以产生新颖音乐和声的专家系统。我从 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