Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

with static linking (and gcc), the ORDER of the libs (and object files) matters.

since highgui depends on core, it must be:

LIBS     =  -lopencv_highgui -lopencv_imgproc -lopencv_core -lpthread -lrt -ldl

in the same manner, your test.o has to go before the libs:

$(APPNAME):$(OBJS)  
    $(CC)  $+ $(LIBDIRS) $(LIBS) -o  $@ $(OPT)

with static linking (and gcc), the ORDER of the libs (and object files) matters.

since highgui depends on core, it must be:

LIBS     =  -lopencv_highgui -lopencv_imgproc -lopencv_core -lpthread -lrt -ldl

in the same manner, your test.o has to go before the libs:

$(APPNAME):$(OBJS)  
    $(CC)  $+ $(LIBDIRS) $(LIBS) -o  $@ $(OPT)

not sure, if i got the last line right, but i hope, you get the idea:

you have to sort your dependancies, bottom up.

with static linking (and gcc), the ORDER of the libs (and object files) matters.

since highgui depends on core, it must be:

LIBS     =  -lopencv_highgui -lopencv_imgproc -lopencv_core -lpthread -lrt -ldl

in the same manner, your test.o has to go before the libs:

$(APPNAME):$(OBJS)  
    $(CC)  $+ $(LIBDIRS) $(LIBS) -o  $@ $(OPT)

not sure, if i got the last line right, but i hope, you get the idea:

with static linking,  you have to sort your dependancies, bottom up.

with static linking (and gcc), the ORDER of the libs (and object files) matters.

since highgui depends on core, it must be:

LIBS     =  -lopencv_highgui -lopencv_imgproc -lopencv_core -lpthread -lrt -ldl

in the same manner, your test.o has to go before the libs:

$(APPNAME):$(OBJS)  
    $(CC)  $+ $(LIBDIRS) $(LIBS) -o  $@ $(OPT)

not sure, if i got the last line right, but i hope, you get the idea:

with static linking,  you have to sort your dependancies, bottom up.

[edit] more libs missing:

last time i tried with 2.4 (no more using that):

g++ -std=c++0x cv.cpp -I ocv/include -L ocv/lib -lopencv_highgui -lopencv_calib3d -lopencv_contrib -lopencv_features2d -lopencv_flann -lopencv_highgui -lopencv_ml -lopencv_nonfree -lopencv_objdetect -lopencv_photo -lopencv_stitching -lopencv_superres -lopencv_ts -lopencv_video -lopencv_videostab -lopencv_legacy -lopencv_imgproc -lopencv_core -ljpeg -lpng -ltiff -lrt -lz -lpthread -o cv

(ofc, you will have to adjust library/include paths)

one last thing about jpg/tiff/png: if you use the system libs, it is -ljpeg , if you use opencv's 3rdparty ones it is: -llibjpeg

with static linking (and gcc), the ORDER of the libs (and object files) matters.

since highgui depends on core, it must be:

LIBS     =  -lopencv_highgui -lopencv_imgproc -lopencv_core -lpthread -lrt -ldl

in the same manner, your test.o has to go before the libs:

$(APPNAME):$(OBJS)  
    $(CC)  $+ $(LIBDIRS) $(LIBS) -o  $@ $(OPT)

not sure, if i got the last line right, but i hope, you get the idea:

with static linking,  you have to sort your dependancies, bottom up.

[edit] more libs missing:missing: (jpeg,tiff,png,zlib)

last time i tried with 2.4 (no more using that):

g++ -std=c++0x cv.cpp -I ocv/include -L ocv/lib -lopencv_highgui -lopencv_calib3d -lopencv_contrib -lopencv_features2d -lopencv_flann -lopencv_highgui -lopencv_ml -lopencv_nonfree -lopencv_objdetect -lopencv_photo -lopencv_stitching -lopencv_superres -lopencv_ts -lopencv_video -lopencv_videostab -lopencv_legacy -lopencv_imgproc -lopencv_core -ljpeg -lpng -ltiff -lrt -lz -lpthread -o cv

(ofc, you will have to adjust library/include paths)

one last thing about jpg/tiff/png: if you use the system libs, it is -ljpeg , if you use opencv's 3rdparty ones it is: -llibjpeg

with static linking (and gcc), the ORDER of the libs (and object files) matters.

since highgui depends on core, it must be:

LIBS     =  -lopencv_highgui -lopencv_imgproc -lopencv_core -lpthread -lrt -ldl

in the same manner, your test.o has to go before the libs:

$(APPNAME):$(OBJS)  
    $(CC)  $+ $(LIBDIRS) $(LIBS) -o  $@ $(OPT)

not sure, if i got the last line right, but i hope, you get the idea:

with static linking,  you have to sort your dependancies, bottom up.

[edit] more libs missing: (jpeg,tiff,png,zlib)

last time i tried with 2.4 (no more using that):

g++ -std=c++0x cv.cpp -I ocv/include -L ocv/lib -lopencv_highgui -lopencv_calib3d -lopencv_contrib -lopencv_features2d -lopencv_flann -lopencv_highgui -lopencv_ml -lopencv_nonfree -lopencv_objdetect -lopencv_photo -lopencv_stitching -lopencv_superres -lopencv_ts -lopencv_video -lopencv_videostab -lopencv_legacy -lopencv_imgproc -lopencv_core -ljpeg -lpng -ltiff -lrt -lz -lpthread -o cv

(ofc, you will have to adjust library/include paths)

one last thing about jpg/tiff/png: if you use the system libs, it is -ljpeg , if you use opencv's 3rdparty ones ones(i think, that'w what you should do with cross-compiling) it is: -llibjpeg

with static linking (and gcc), the ORDER of the libs (and object files) matters.

since highgui depends on core, it must be:

LIBS     =  -lopencv_highgui -lopencv_imgproc -lopencv_core -lpthread -lrt -ldl

in the same manner, your test.o has to go before the libs:

$(APPNAME):$(OBJS)  
    $(CC)  $+ $(LIBDIRS) $(LIBS) -o  $@ $(OPT)

not sure, if i got the last line right, but i hope, you get the idea:

with static linking,  you have to sort your dependancies, bottom up.

[edit] more libs missing: (jpeg,tiff,png,zlib)

last time i tried with 2.4 (no more using that):

g++ -std=c++0x cv.cpp -I ocv/include -L ocv/lib -lopencv_highgui -lopencv_calib3d -lopencv_contrib -lopencv_features2d -lopencv_flann -lopencv_highgui -lopencv_ml -lopencv_nonfree -lopencv_objdetect -lopencv_photo -lopencv_stitching -lopencv_superres -lopencv_ts -lopencv_video -lopencv_videostab -lopencv_legacy -lopencv_imgproc -lopencv_core -ljpeg -lpng -ltiff -lrt -lz -lpthread -o cv

(ofc, you will have to adjust library/include paths)

one last thing about jpg/tiff/png: if you use the system libs, it is -ljpeg , if you use opencv's 3rdparty ones(i think, that'w that's what you should do with cross-compiling) it is: -llibjpeg