| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1330 人关注过本帖
标题:一个关于c++的问题
只看楼主 加入收藏
jeffwang
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2009-6-14
结帖率:0
收藏
 问题点数:0 回复次数:1 
一个关于c++的问题
大家好,我想将一个linux版本的C++程序改成windows版本,用VS 2008 调试后,有一堆链接错误,我不太熟悉VS 2008,如下:

FeatureExtractor.obj : error LNK2005: "double __cdecl log2(double)" (?log2@@YANN@Z) already defined in ExtraTreeClassifier.obj
1>frimcla.obj : error LNK2005: "double __cdecl log2(double)" (?log2@@YANN@Z) already defined in ExtraTreeClassifier.obj
1>LINK : warning LNK4067: ambiguous entry point; selected 'mainCRTStartup'
1>MaskImage.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall Magick::Image::~Image(void)" (__imp_??1Image@Magick@@UAE@XZ)
1>ExtraTreeClassifier.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall Magick::Image::~Image(void)" (__imp_??1Image@Magick@@UAE@XZ) referenced in function "void __cdecl printDecisionPatterns(class std::list<class TerminalNode *,class std::allocator<class TerminalNode *> > *)" (?printDecisionPatterns@@YAXPAV?$list@PAVTerminalNode@@V?$allocator@PAVTerminalNode@@@std@@@std@@@Z)
1>FeatureExtractor.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall Magick::Image::~Image(void)" (__imp_??1Image@Magick@@UAE@XZ)
1>frimcla.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall Magick::Image::~Image(void)" (__imp_??1Image@Magick@@UAE@XZ)

我不知道这是为什么,请高手解答,谢谢。以下是我的makeefile:

MAGICKCONFIG=Magick++-config
MAGICKCPPFLAGS=-DIMAGEMAGICK `$(MAGICKCONFIG) --cppflags`
MAGICKLDFLAGS=`$(MAGICKCONFIG) --ldflags --libs` -ldl

INCLUDE=-I./SIFT -I./libsvm

#CPPFLAGS=$(MAGICKCPPFLAGS) $(INCLUDE) -o3 -Wall
CPPFLAGS=$(MAGICKCPPFLAGS) $(INCLUDE) -g -Wall -O3
LDFLAGS=$(MAGICKLDFLAGS) #-lpthread -L../progs/Duma -lduma

CFLAGS=-W -Wall -g -O3
#CFLAGS=-W -Wall -g #-pg

# uncomment the below if you have SIFT sources
# CFLAGS += -DHAVE_SIFT
# SIFT_SRC=    SIFT/ParametersManager.c \
#                     SIFT/Matrix.c \
#                     SIFT/PgmIo.c \
#                     SIFT/Convolution.c \
#                     SIFT/BilinearInterpolation.c \
#                     SIFT/ResizeImage.c \
#                     SIFT/ImagePyramid.c \
#                     SIFT/Filter.c \
#                     SIFT/Detector.c \
#                     SIFT/InterestPoint.c \
#                     SIFT/Normalizer.c \
#                     SIFT/Sift.c
# SIFT_OBJ=    $(SIFT_SRC:.c=.o)

FRIMCLA_SRC=    ClassLabelHistogram.cpp \
                            DecisionNode.cpp \
                            ExtraTreeClassifier.cpp \
                            FeatureExtractor.cpp \
                            FeatureVector.cpp \
                            FMUtils.cpp \
                            frimcla.cpp \
                            IntegralImage.cpp \
                            MaskImage.cpp \
                            PDF.cpp \
                            SvmClassifier.cpp \
                            libsvm/svm.cpp \
                            TerminalNode.cpp

FRIMCLA_OBJ=    $(FRIMCLA_SRC:.cpp=.o)

all:frimcla

frimcla: $(FRIMCLA_OBJ) $(SIFT_OBJ)
    g++ $(LDFLAGS) $(FRIMCLA_OBJ) $(SIFT_OBJ) -lm -o frimcla

frimcla.o: frimclaUtils.cpp frimclaUtils2.cpp

test:test.o FMUtils.o FeatureVector.o SvmClassifier.o ClassLabelHistogram.o libsvm/svm.o
libsvm/svm.o:libsvm/svm.cpp
ClassLabelHistogram.o:ClassLabelHistogram.cpp
FeatureVector.o:FeatureVector.cpp
SvmClassifier.o:SvmClassifier.cpp
test.o:test.cpp
FMUtils.o:FMUtils.cpp

.SUFFIXES: .cpp .o

.cpp.o:
    g++ -c $(INCLUDE) $(CPPFLAGS) -o $@ $<

.c.o:
    g++ -c $(INCLUDE) $(CFLAGS) -o $@ $<

clean:
    -rm -f *.o *~ frimcla
    -rm -f libsvm/*.o libsvm/*~
    -rm -f SIFT/*.o SIFT/*~

搜索更多相关主题的帖子: windows linux 
2010-01-03 23:17
flylee
Rank: 5Rank: 5
等 级:职业侠客
帖 子:309
专家分:374
注 册:2004-8-10
收藏
得分:0 
你在win下用gcc把程序编译链接成win格式的二进制不就行了吗?
2010-01-04 19:46
快速回复:一个关于c++的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.049774 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved