1

since a few hours now I am having a few problems with passing references in programming with c++ under Windows 7:

(the code I am working with is copied)

I am having my main which calls a few functions defined in a header-file. The passed values are static references, for instance:

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; 
}

If I clean and build my project (I am using NetBeans), I get the following error(s):

[...]
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)

with a lot more of these "undefined references to..." I deleted here.

What is my problem?

andschi
  • 31
  • 5

0 Answers0