在Windows 7下传递C ++编程中的引用不起作用:未定义的引用

时间:2016-07-25 17:40:16

标签: c++ reference windows-7 header

因为几个小时后我在使用Windows 7下的c ++编程时传递引用有一些问题:

(我正在使用的代码被复制)

我正在使用main调用头文件中定义的一些函数。传递的值是静态引用,例如:

static void generate(const int &_N,const int &_M, const cv::Mat &_TRANS,const cv::Mat &_EMIS, const cv::Mat &_INIT, cv::Mat &seq, cv::Mat &states) {
    std::cout << "Function generate called!" << std::endl; 
}

如果我清理并构建我的项目(我正在使用NetBeans),我会收到以下错误:

[...]
CLEAN SUCCESSFUL (total time: 753ms)
cd 'C:\Users\[...]\CppApplication1'
C:\MinGW\msys\1.0\bin\make.exe -f Makefile CONF=Debug
"/C/MinGW/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make.exe[1]: Entering directory `/c/Users/[...]/CppApplication1'
"/C/MinGW/msys/1.0/bin/make.exe"  -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/cppapplication1.exe
make.exe[2]: Entering directory `/c/Users/[...]/CppApplication1'
mkdir -p build/Debug/MinGW-Windows
rm -f "build/Debug/MinGW-Windows/main.o.d"
g++    -c -g -I../../../../../../opencv/build/include -MMD -MP -MF "build/Debug/MinGW-Windows/main.o.d" -o build/Debug/MinGW-Windows/main.o main.cpp
mkdir -p dist/Debug/MinGW-Windows
g++     -o dist/Debug/MinGW-Windows/cppapplication1 build/Debug/MinGW-Windows/main.o 
build/Debug/MinGW-Windows/main.o: In function `ZN2cv6StringC1EPKc':
C:\[...]/opencv/build/include/opencv2/core/cvstd.hpp:625: undefined reference to `cv::String::allocate(unsigned int)'
[...]
[...]
[...]
collect2.exe: error: ld returned 1 exit status
make.exe[2]: *** [dist/Debug/MinGW-Windows/cppapplication1.exe] Error 1
make.exe[2]: Leaving directory `/c/Users/[...]/CppApplication1'
make.exe[1]: *** [.build-conf] Error 2
make.exe[1]: Leaving directory `/c/Users/[...]/CppApplication1'
make.exe": *** [.build-impl] Error 2

BUILD FAILED (exit value 2, total time: 2s)

有更多这些&#34;未定义的引用...&#34;我在这里删了。

我的问题是什么?

0 个答案:

没有答案