我有以下几段代码:
Leomedia.h
#include "MusicMetaDatter.h" #ifndef LEOMEDIA_H #define LEOMEDIA_H namespace Leomedia { typedef enum { read,write } FileMode; } #endif // LEOMEDIA_H
MusicMetaDatter.h
#ifndef MUSICMetaDATTER_H #define MUSICMetaDATTER_H #include "Leomedia.h" #include <string> /** * MetaDATTER * @Version 1.0.0a * @Author: Sergio Andrés Ibañez (Leonnears) * @Twitter: Leonnears * @Package: Leomedia */ namespace Leomedia { typedef enum { mp3,m4a,flac,ape,wavPack,aiff,wav,ogg,tta } AudioFileType; class MusicMetaDatter { public: MusicMetaDatter(std::string fileName,AudioFileType type,FileMode mode); virtual ~MusicMetaDatter(); private: std::string md_fileName; AudioFileType md_fileType; FileMode md_fileMode; }; } #endif // MUSICMetaDATTER_H
MusicMetaDatter.cpp
#include "MusicMetaDatter.h" #include <string> Leomedia::MusicMetaDatter::MusicMetaDatter(std::string fileName,FileMode mode) { this -> md_fileName = fileName; this -> md_fileType = type; this -> md_fileMode = mode; } Leomedia::MusicMetaDatter::~MusicMetaDatter() { //dtor }
MetaDatterTest.cpp
#include <iostream> #include "Leomedia.h" #include <string> using namespace std; int main() { Leomedia::MusicMetaDatter Meta("troll",Leomedia::mp3,Leomedia::read); return 0; }
未定义引用Leomedia :: MusicMetaDatter :: MusicMetaDatter(std :: string,Leomedia :: AudioFileType,Leomedia :: FileMode)’
未定义的引用Leomedia :: MusicMetaDatter :: ~MusicMetaDatter()’
未定义的引用Leomedia :: MusicMetaDatter :: ~MusicMetaDatter()’
所有文件都在同一目录中.我正在使用mingw 4.4.1
有人可以帮我弄这个吗?它使我无法理解.