将IPP 2018与mingw联系起来

时间:2017-12-07 15:12:57

标签: mingw intel-ipp

我正在尝试使用2018版本的英特尔IPP与mingw,我无法将英特尔提供的.lib链接到我的程序。我正在编译的程序是https://software.intel.com/en-us/ipp-dev-guide-building-intel-ipp-applications

的IPP示例

这是makefile:

HDIR = "C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018.1.156\windows\ipp\include"
LDADD = "C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018.1.156\windows\ipp\lib\intel64_win"
SOURCES= test.cpp 
OBJECTS1=$(patsubst %.cpp,%.o,$(SOURCES))
OBJECTS=$(patsubst %.c,%.o,$(OBJECTS1))

all debug profile static depend: $(OBJECTS)
    g++ -o test.exe test.o $(CXXFLAGS) -L$(LDADD) -lippcc -lippi -lipps -lippcore -lm


%.o: %.cpp
    g++ -c $< -I $(HDIR) $(CXXFLAGS) 

%.o: %.c
    g++ -c $< -I $(HDIR) $(CXXFLAGS)

clean:
    rm -f *.o

这是gcc输出:

g++ -c test.cpp -I "C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_
2018.1.156\windows\ipp\include"
g++ -o test.exe test.o  -L"C:\Program Files (x86)\IntelSWTools\compilers_and_lib
raries_2018.1.156\windows\ipp\lib\intel64_win" -lippcc -lippi -lipps -lippcore -
lm
test.o:test.cpp:(.text+0x14): undefined reference to `ippInit'
test.o:test.cpp:(.text+0x19): undefined reference to `ippGetLibVersion'
test.o:test.cpp:(.text+0x5f): undefined reference to `ippGetCpuFeatures'
test.o:test.cpp:(.text+0x79): undefined reference to `ippGetEnabledCpuFeatures'
collect2: error: ld returned 1 exit status
Makefile:8: recipe for target 'all' failed
make: *** [all] Error 1

链接器正在查找库,但我不明白为什么我会得到未定义的引用。有没有人用mingw编译最近的IPP版本?

1 个答案:

答案 0 :(得分:0)

我通过链接到.dll而不是.lib,并使用32位版本的dll来解决它(愚蠢的是我虽然我的gcc是64位,但它不是)。

为库提供链接的正确途径是:

LDADD = "C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2018.1.156\windows\redist\ia32_win\ipp"

(如果您使用的是32位)