非常简单的应用程序失败,“多目标模式”从Eclipse [英] Very simple application fails with "multiple target patterns" from Eclipse

查看:178
本文介绍了非常简单的应用程序失败,“多目标模式”从Eclipse的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因为我更喜欢使用Eclipse,我以为我会尝试从Visual Studio转换我的项目。昨天我试了一个很简单的小测试。无论我尝试什么,使失败与多目标模式。 (这类似于这个未回答的问题)。



我有三个文件:



Application.cpp:

 code> using namespace std; 

#includeWindow.h

int main(){
Window * win = new Window();
delete& win;
return 0;
}

Window.h:

  #ifndef WINDOW_H_ 
#define WINDOW_H_

class Window {
public:
Window();
〜Window();
};

#endif

Window.cpp:

  #include< cv.h> 
#include< highgui.h>

#includeWindow.h

const char * WINDOW_NAME =MyApp;

Window :: Window(){
cvNamedWindow(WINDOW_NAME,CV_WINDOW_AUTOSIZE);
cvResizeWindow(WINDOW_NAME,200,200);
cvMoveWindow(WINDOW_NAME,0,0);
int key = 0;
while(true){
key = cvWaitKey(0);
if(key == 27 || cvGetWindowHandle(WINDOW_NAME)== 0){
break;
}
}
}
Window ::〜Window(){
cvDestroyWindow(WINDOW_NAME);
}

我已经将以下路径添加到编译器包含路径( -I ):

 $(OPENCV)/ cv / include
$(OPENCV)/ cxcore / include
$(OPENCV)/ otherlibs / highgui

我已将以下库添加到链接器( -l <​​/ code>):

 code> cv 
cxcore
highgui

以下图书馆搜索路径( -L ):

 $(OPENCV)/ lib /

Eclipse,编译器和链接器都成功地包含了标题和库。我正在使用GNU C / C ++编译器链接器从Cygwin。



编译时,我得到以下 make 错误:



src / Window.d:1:***多个目标模式。停止。



Window.d包含:

  src / Window.d src / Window.o:../src/Window.cpp \ 
C:/ Program\ Files / OpenCV / cv / include / cv.h \\ \\
C:/ Program\ Files / OpenCV / cxcore / include / cxcore.h \
C:/ Program\ Files / OpenCV / cxcore / include / cxtypes.h \
C:/ Program\ Files / OpenCV / cxcore / include / cxerror.h \
C:/ Program\ Files / OpenCV / cxcore / include / cvver.h \
C:/程序\文件/ OpenCV / cxcore / include / cxcore.hpp \
C:/ Program\ Files / OpenCV / cv / include / cvtypes.h \
C:/ Program\ Files /OpenCV/cv/include/cv.hpp \
C:/ Program\ Files / OpenCV / cv / include / cvcompat.h \
C:/ Program\ Files / OpenCV / otherlibs /highgui/highgui.h \
C:/ Program\ Files / OpenCV / cxcore / include / cxcore.h ../src/Constants.h \
../src/Window。 h
C:/ Program\ Files / OpenCV / cv / include / cv.h:
C:/ Program\ Files / Open c / c / c / c / c / c / c / c / c / cxerror.h:
C:/ Program\ Files / OpenCV / cxcore / include / cvver.h:
C:/ Program\ Files / OpenCV / cxcore / include / cxcore.hpp:
C:/ Program\ Files / OpenCV / cv / include / cvtypes.h:
C:/ Program\ Files / OpenCV / cv / include / cv.hpp:
C:/ Program \ Files / OpenCV / cv / include / cvcompat.h:
C:/ Program\ Files / OpenCV / otherlibs / highgui / highgui.h:
C:/ Program\ Files / OpenCV / cxcore / include / cxcore.h:
../src/Window.h:

我尝试从Window.d(从第2行开始)删除所有OpenCV标头,但是错误仍然存​​在。此外,我已经更新了Eclipse和OpenCV,都无济于事。



你有什么想法值得吗?我愿意尝试任何东西!

解决方案

您是从Cygwin安装工作吗?



我在使用Cygwin之前看到这个问题 - 基本上, make 看到在路径中,认为它是另一个目标定义,因此出现错误。



如果您是从Cygwin安装工作,您可以尝试将 c:/ 替换为 / cygdrive / c / 。如果没有,您可以尝试使用相对路径或使用网络挂载,并查看是否修复它。


Since I'm more comfortable using Eclipse, I thought I'd try converting my project from Visual Studio. Yesterday I tried a very simple little test. No matter what I try, make fails with "multiple target patterns". (This is similar to this unanswered question.)

I have three files:

Application.cpp:

using namespace std;

#include "Window.h"

int main() {
    Window *win = new Window();
    delete &win;
    return 0;
}

Window.h:

#ifndef WINDOW_H_
#define WINDOW_H_

class Window {
public:
    Window();
    ~Window();
};

#endif

Window.cpp:

#include <cv.h>
#include <highgui.h>

#include "Window.h"

const char* WINDOW_NAME = "MyApp";

Window::Window() {
    cvNamedWindow(WINDOW_NAME, CV_WINDOW_AUTOSIZE);
    cvResizeWindow(WINDOW_NAME, 200, 200);
    cvMoveWindow(WINDOW_NAME, 0, 0);
    int key = 0;
    while (true) {
        key = cvWaitKey(0);
        if (key==27 || cvGetWindowHandle(WINDOW_NAME)==0) {
            break;
        }
    }
}
Window::~Window() {
    cvDestroyWindow(WINDOW_NAME);
}

I have added the following paths to the compiler include path (-I):

"$(OPENCV)/cv/include"
"$(OPENCV)/cxcore/include"
"$(OPENCV)/otherlibs/highgui"

I have added the following libraries to the linker (-l):

cv
cxcore
highgui

And the following library search path (-L):

"$(OPENCV)/lib/"

Eclipse, the compiler and the linker all succeed in including the headers and libraries. I am using the GNU C/C++ compiler & linker from Cygwin.

When compiling, I get the following make error:

src/Window.d:1: *** multiple target patterns. Stop.

Window.d contains:

src/Window.d src/Window.o: ../src/Window.cpp \
  C:/Program\ Files/OpenCV/cv/include/cv.h \
  C:/Program\ Files/OpenCV/cxcore/include/cxcore.h \
  C:/Program\ Files/OpenCV/cxcore/include/cxtypes.h \
  C:/Program\ Files/OpenCV/cxcore/include/cxerror.h \
  C:/Program\ Files/OpenCV/cxcore/include/cvver.h \
  C:/Program\ Files/OpenCV/cxcore/include/cxcore.hpp \
  C:/Program\ Files/OpenCV/cv/include/cvtypes.h \
  C:/Program\ Files/OpenCV/cv/include/cv.hpp \
  C:/Program\ Files/OpenCV/cv/include/cvcompat.h \
  C:/Program\ Files/OpenCV/otherlibs/highgui/highgui.h \
  C:/Program\ Files/OpenCV/cxcore/include/cxcore.h ../src/Constants.h \
  ../src/Window.h
C:/Program\ Files/OpenCV/cv/include/cv.h:
C:/Program\ Files/OpenCV/cxcore/include/cxcore.h:
C:/Program\ Files/OpenCV/cxcore/include/cxtypes.h:
C:/Program\ Files/OpenCV/cxcore/include/cxerror.h:
C:/Program\ Files/OpenCV/cxcore/include/cvver.h:
C:/Program\ Files/OpenCV/cxcore/include/cxcore.hpp:
C:/Program\ Files/OpenCV/cv/include/cvtypes.h:
C:/Program\ Files/OpenCV/cv/include/cv.hpp:
C:/Program\ Files/OpenCV/cv/include/cvcompat.h:
C:/Program\ Files/OpenCV/otherlibs/highgui/highgui.h:
C:/Program\ Files/OpenCV/cxcore/include/cxcore.h:
../src/Window.h:

I tried removing all OpenCV headers from Window.d (from line 2 onwards), but the error remains. Also, I've updated Eclipse and OpenCV, all to no avail.

Do you have any ideas worth trying? I'm willing to try anything!

解决方案

Are you working from a Cygwin installation?

I've seen this problem before using Cygwin--basically, make sees the : in the path and thinks it is another target definition, hence the error.

If you are working from a Cygwin installation, you might try replacing the c:/ with /cygdrive/c/. If not, you might try using relative paths or using a network mount and see if that fixes it.

这篇关于非常简单的应用程序失败,“多目标模式”从Eclipse的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆