I am trying to build my c++ project using this make file :
CXX=g++ -std=c++11
LD=g++
DEFINES = -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NO_VERSION_TAGGING
CFLAGS = -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIC $(DEFINES)
CXXFLAGS = -m64 -pipe -O2 -std=gnu++0x -Wall -W -D_REENTRANT -fPIC $(DEFINES)
INCPATH = -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64
QMAKE = /usr/lib/x86_64-linux-gnu/qt5/bin/qmake
DEL_FILE = rm -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
COPY = cp -f
COPY_FILE = cp -f
COPY_DIR = cp -f -R
INSTALL_FILE = install -m 644 -p
INSTALL_PROGRAM = install -m 755 -p
INSTALL_DIR = cp -f -R
DEL_FILE = rm -f
SYMLINK = ln -f -s
DEL_DIR = rmdir
MOVE = mv -f
TAR = tar -cf
COMPRESS = gzip -9f
LINK = g++
LFLAGS = -m64 -Wl,-O1
LIBS = $(SUBLIBS) -L/usr/X11R6/lib64 -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread
AR = ar cqs
RANLIB =
SED = sed
STRIP = strip
LIBS= $(SUBLIBS) -L/usr/X11R6/lib64 -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread
INCPATH= -I. -I. -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64
LDFLAGS=-Wall -fPIC -Wextra -O3 -fopenmp -L/usr/X11R6/lib -lX11 -lSDL -lrt -lpthread -lXft -L/usr/local/lib/mysql -lmysqlclient -lXpm -L./ -lMyTestLicense
FREETYPE_CFLAGS=$(shell freetype-config --cflags )
FREETYPE_LDFLAGS=$(shell freetype-config --libs)
####### Output directory
OBJECTS_DIR = ./
####### Files
SOURCES=$(wildcard *.cpp)
OBJECTS=$(SOURCES:.cpp=.o)
EXECUTABLE=test
QMAKE_TARGET = test
DESTDIR =
TARGET = test
####### Build rules
$(TARGET): $(OBJECTS)
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
all:$(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(LD) $(FREETYPE_LDFLAGS) $(OBJECTS) $(LDFLAGS) -o $#
####### Compile
.cpp.o:
$(CXX) $(FREETYPE_CFLAGS) $(CXXFLAGS) $(INCPATH) -c -Wno-write-strings -g -fpermissive $< -o $#
clean:
rm -rf *o test
i did not try to create make file using qmake because of special library that i need in my own project, So i decided to write my own makefile, and this is the only class(testmain.cpp) in my source code that i use QT library in it,thi is testmain.cpp:
#include <QtWidgets>
int main(int argc, char **argv)
{
QApplication app(argc, argv);
QWidget qWin;
QGridLayout qGrid;
qGrid.addWidget(new QLabel("UTF-8:"), 1, 0);
QByteArray string = "شهاب حسینی";
QTextCodec *codec = QTextCodec::codecForName("UTF-8");
QString encodedString = codec->toUnicode(string);
qGrid.addWidget(new QLabel(encodedString), 1, 1);
qWin.setLayout(&qGrid);
qWin.show();
return app.exec();
}
but when I try to make my project ,executable test will not produce and i face with this errors which part of my make file is wrong ?
> In function `QTypedArrayData<char>::deallocate(QArrayData*)':
> /usr/include/x86_64-linux-gnu/qt5/QtCore/qarraydata.h:222: undefined
> reference to `QArrayData::deallocate(QArrayData*, unsigned long,
> unsigned long)' testmain.o: In function `QTypedArrayData<unsigned
> short>::deallocate(QArrayData*)':
> /usr/include/x86_64-linux-gnu/qt5/QtCore/qarraydata.h:222: undefined
> reference to `QArrayData::deallocate(QArrayData*, unsigned long,
> unsigned long)'
darknet
My application is to record sound via microphone, to preprocess like fft, and to classify voice activities. I composed own code that deals with recording,converting into *.wav,and doing learning and predicting in the name of sound.c. At this time, I do not need image processing.
Anyway, followings are what I get during make.
#-desktop:~/darknet_tmp$ make
PATH:=/usr/local/cuda-11.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/cuda/bin:/usr/local/cuda/lib64
g++ -std=c++11 -std=c++11 -Iinclude/ -I3rdparty/stb/include -DGPU -I/usr/local/cuda/include/ -DCUDNN -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DGPU -DCUDNN -I/usr/local/cudnn/include -fPIC obj/sound.o obj/http_stream.o obj/gemm.o obj/utils.o obj/dark_cuda.o obj/convolutional_layer.o obj/list.o obj/image.o obj/activations.o obj/im2col.o obj/col2im.o obj/blas.o obj/crop_layer.o obj/dropout_layer.o obj/maxpool_layer.o obj/softmax_layer.o obj/data.o obj/matrix.o obj/network.o obj/connected_layer.o obj/cost_layer.o obj/parser.o obj/option_list.o obj/darknet.o obj/detection_layer.o obj/captcha.o obj/route_layer.o obj/writing.o obj/box.o obj/nightmare.o obj/normalization_layer.o obj/avgpool_layer.o obj/coco.o obj/dice.o obj/yolo.o obj/detector.o obj/layer.o obj/compare.o obj/classifier.o obj/local_layer.o obj/swag.o obj/shortcut_layer.o obj/activation_layer.o obj/rnn_layer.o obj/gru_layer.o obj/rnn.o obj/rnn_vid.o obj/crnn_layer.o obj/demo.o obj/tag.o obj/cifar.o obj/go.o obj/batchnorm_layer.o obj/art.o obj/region_layer.o obj/reorg_layer.o obj/reorg_old_layer.o obj/super.o obj/voxel.o obj/tree.o obj/yolo_layer.o obj/gaussian_yolo_layer.o obj/upsample_layer.o obj/lstm_layer.o obj/conv_lstm_layer.o obj/scale_channels_layer.o obj/sam_layer.o obj/convolutional_kernels.o obj/activation_kernels.o obj/im2col_kernels.o obj/col2im_kernels.o obj/blas_kernels.o obj/crop_layer_kernels.o obj/dropout_layer_kernels.o obj/maxpool_layer_kernels.o obj/network_kernels.o obj/avgpool_layer_kernels.o -o darknet -lm -pthread -L/usr/local/cuda/lib64 -lcuda -lcudart -lcublas -lcurand -L/usr/local/cudnn/lib64 -lcudnn -lstdc++
obj/darknet.o: In function `main':
darknet.c:(.text.startup+0xae): undefined reference to `show_opencv_info'
obj/network_kernels.o: In function `backward_network_gpu':
tmpxft_00001197_00000000-6_network_kernels.cudafe1.cpp:(.text+0xc90): undefined reference to `resize_window_cv'
obj/network_kernels.o: In function `train_network_datum_gpu':
tmpxft_00001197_00000000-6_network_kernels.cudafe1.cpp:(.text+0x163a): undefined reference to `resize_window_cv'
tmpxft_00001197_00000000-6_network_kernels.cudafe1.cpp:(.text+0x1644): undefined reference to `wait_key_cv'
obj/data.o: In function `load_data_detection':
data.c:(.text+0x4dba): undefined reference to `wait_until_press_key_cv'
obj/data.o: In function `load_data_augment':
data.c:(.text+0x5ad2): undefined reference to `wait_until_press_key_cv'
obj/network.o: In function `train_network_waitkey':
network.c:(.text+0x13db): undefined reference to `wait_key_cv'
obj/writing.o: In function `test_writing':
writing.c:(.text+0x9ae): undefined reference to `wait_until_press_key_cv'
writing.c:(.text+0x9b5): undefined reference to `destroy_all_windows_cv'
obj/coco.o: In function `test_coco':
coco.c:(.text+0x1ac0): undefined reference to `wait_until_press_key_cv'
coco.c:(.text+0x1ac7): undefined reference to `destroy_all_windows_cv'
obj/yolo.o: In function `test_yolo':
yolo.c:(.text+0x1a40): undefined reference to `wait_until_press_key_cv'
yolo.c:(.text+0x1a47): undefined reference to `destroy_all_windows_cv'
obj/detector.o: In function `test_detector':
detector.c:(.text+0x8a0b): undefined reference to `wait_until_press_key_cv'
detector.c:(.text+0x8a12): undefined reference to `destroy_all_windows_cv'
collect2: error: ld returned 1 exit status
Makefile:173: recipe for target 'darknet' failed
make: *** [darknet] Error 1
I need your help and advice.
Makefile
GPU=1
CUDNN=1
CUDNN_HALF=0
OPENCV=0
AVX=0
OPENMP=0
LIBSO=1
ZED_CAMERA=0
ZED_CAMERA_v2_8=0
export PATH:=${PATH}:/usr/local/cuda/bin
export PATH:=${PATH}:/usr/local/cuda/lib64
$(info PATH:=${PATH})
# set GPU=1 and CUDNN=1 to speedup on GPU
# set CUDNN_HALF=1 to further speedup 3 x times (Mixed-precision on Tensor Cores) GPU: Volta, Xavier, Turing and higher
# set AVX=1 and OPENMP=1 to speedup on CPU (if error occurs then set AVX=0)
# set ZED_CAMERA=1 to enable ZED SDK 3.0 and above
# set ZED_CAMERA_v2_8=1 to enable ZED SDK 2.X
USE_CPP=0
DEBUG=0
#ARCH= -gencode arch=compute_30,code=sm_30 \
# -gencode arch=compute_35,code=sm_35 \
# -gencode arch=compute_50,code=[sm_50,compute_50] \
# -gencode arch=compute_52,code=[sm_52,compute_52] \
# -gencode arch=compute_61,code=[sm_61,compute_61]
ARCH= -gencode arch=compute_61,code=sm_61 -gencode arch=compute_61,code=compute_61
OS := $(shell uname)
# Tesla A100 (GA100), DGX-A100, RTX 3080
# ARCH= -gencode arch=compute_80,code=[sm_80,compute_80]
# Tesla V100
# ARCH= -gencode arch=compute_70,code=[sm_70,compute_70]
# GeForce RTX 2080 Ti, RTX 2080, RTX 2070, Quadro RTX 8000, Quadro RTX 6000, Quadro RTX 5000, Tesla T4, XNOR Tensor Cores
# ARCH= -gencode arch=compute_75,code=[sm_75,compute_75]
# Jetson XAVIER
# ARCH= -gencode arch=compute_72,code=[sm_72,compute_72]
# GTX 1080, GTX 1070, GTX 1060, GTX 1050, GTX 1030, Titan Xp, Tesla P40, Tesla P4
# ARCH= -gencode arch=compute_61,code=sm_61 -gencode arch=compute_61,code=compute_61
# GP100/Tesla P100 - DGX-1
# ARCH= -gencode arch=compute_60,code=sm_60
# For Jetson TX1, Tegra X1, DRIVE CX, DRIVE PX - uncomment:
# ARCH= -gencode arch=compute_53,code=[sm_53,compute_53]
# For Jetson Tx2 or Drive-PX2 uncomment:
# ARCH= -gencode arch=compute_62,code=[sm_62,compute_62]
VPATH=./src/
EXEC=darknet
OBJDIR=./obj/
ifeq ($(LIBSO), 1)
LIBNAMESO=libdarknet.so
APPNAMESO=uselib
endif
ifeq ($(USE_CPP), 1)
CC=g++
else
CC=gcc
endif
CPP=g++ -std=c++11
NVCC=nvcc
OPTS=-Ofast
LDFLAGS= -lm -pthread
COMMON= -Iinclude/ -I3rdparty/stb/include
CFLAGS=-Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC
ifeq ($(DEBUG), 1)
#OPTS= -O0 -g
#OPTS= -Og -g
COMMON+= -DDEBUG
CFLAGS+= -DDEBUG
else
ifeq ($(AVX), 1)
CFLAGS+= -ffp-contract=fast -mavx -mavx2 -msse3 -msse4.1 -msse4.2 -msse4a
endif
endif
CFLAGS+=$(OPTS)
ifneq (,$(findstring MSYS_NT,$(OS)))
LDFLAGS+=-lws2_32
endif
ifeq ($(OPENCV), 1)
COMMON+= -DOPENCV
CFLAGS+= -DOPENCV
LDFLAGS+= `pkg-config --libs opencv4 2> /dev/null || pkg-config --libs opencv`
COMMON+= `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv`
endif
ifeq ($(OPENMP), 1)
ifeq ($(OS),Darwin) #MAC
CFLAGS+= -Xpreprocessor -fopenmp
else
CFLAGS+= -fopenmp
endif
LDFLAGS+= -lgomp
endif
ifeq ($(GPU), 1)
COMMON+= -DGPU -I/usr/local/cuda/include/
CFLAGS+= -DGPU
ifeq ($(OS),Darwin) #MAC
LDFLAGS+= -L/usr/local/cuda/lib -lcuda -lcudart -lcublas -lcurand
else
LDFLAGS+= -L/usr/local/cuda/lib64 -lcuda -lcudart -lcublas -lcurand
endif
endif
ifeq ($(CUDNN), 1)
COMMON+= -DCUDNN
ifeq ($(OS),Darwin) #MAC
CFLAGS+= -DCUDNN -I/usr/local/cuda/include
LDFLAGS+= -L/usr/local/cuda/lib -lcudnn
else
CFLAGS+= -DCUDNN -I/usr/local/cudnn/include
LDFLAGS+= -L/usr/local/cudnn/lib64 -lcudnn
endif
endif
ifeq ($(CUDNN_HALF), 1)
COMMON+= -DCUDNN_HALF
CFLAGS+= -DCUDNN_HALF
ARCH+= -gencode arch=compute_70,code=[sm_70,compute_70]
endif
ifeq ($(ZED_CAMERA), 1)
CFLAGS+= -DZED_STEREO -I/usr/local/zed/include
ifeq ($(ZED_CAMERA_v2_8), 1)
LDFLAGS+= -L/usr/local/zed/lib -lsl_core -lsl_input -lsl_zed
#-lstdc++ -D_GLIBCXX_USE_CXX11_ABI=0
else
LDFLAGS+= -L/usr/local/zed/lib -lsl_zed
#-lstdc++ -D_GLIBCXX_USE_CXX11_ABI=0
endif
endif
OBJ=sound.o http_stream.o gemm.o utils.o dark_cuda.o convolutional_layer.o list.o image.o activations.o im2col.o col2im.o blas.o crop_layer.o dropout_layer.o maxpool_layer.o softmax_layer.o data.o matrix.o network.o connected_layer.o cost_layer.o parser.o option_list.o darknet.o detection_layer.o captcha.o route_layer.o writing.o box.o nightmare.o normalization_layer.o avgpool_layer.o coco.o dice.o yolo.o detector.o layer.o compare.o classifier.o local_layer.o swag.o shortcut_layer.o activation_layer.o rnn_layer.o gru_layer.o rnn.o rnn_vid.o crnn_layer.o demo.o tag.o cifar.o go.o batchnorm_layer.o art.o region_layer.o reorg_layer.o reorg_old_layer.o super.o voxel.o tree.o yolo_layer.o gaussian_yolo_layer.o upsample_layer.o lstm_layer.o conv_lstm_layer.o scale_channels_layer.o sam_layer.o
ifeq ($(GPU), 1)
LDFLAGS+= -lstdc++
OBJ+=convolutional_kernels.o activation_kernels.o im2col_kernels.o col2im_kernels.o blas_kernels.o crop_layer_kernels.o dropout_layer_kernels.o maxpool_layer_kernels.o network_kernels.o avgpool_layer_kernels.o
endif
OBJS = $(addprefix $(OBJDIR), $(OBJ))
DEPS = $(wildcard src/*.h) Makefile include/darknet.h
all: $(OBJDIR) backup results $(EXEC) $(LIBNAMESO) $(APPNAMESO)
ifeq ($(LIBSO), 1)
CFLAGS+= -fPIC
$(LIBNAMESO): $(OBJDIR) $(OBJS) include/yolo_v2_class.hpp src/yolo_v2_class.cpp
$(CPP) -shared -std=c++11 -fvisibility=hidden -DLIB_EXPORTS $(COMMON) $(CFLAGS) $(OBJS) src/yolo_v2_class.cpp -o $# $(LDFLAGS)
$(APPNAMESO): $(LIBNAMESO) include/yolo_v2_class.hpp src/yolo_console_dll.cpp
$(CPP) -std=c++11 $(COMMON) $(CFLAGS) -o $# src/yolo_console_dll.cpp $(LDFLAGS) -L ./ -l:$(LIBNAMESO)
endif
$(EXEC): $(OBJS)
$(CPP) -std=c++11 $(COMMON) $(CFLAGS) $^ -o $# $(LDFLAGS)
$(OBJDIR)%.o: %.c $(DEPS)
$(CC) $(COMMON) $(CFLAGS) -c $< -o $#
$(OBJDIR)%.o: %.cpp $(DEPS)
$(CPP) -std=c++11 $(COMMON) $(CFLAGS) -c $< -o $#
$(OBJDIR)%.o: %.cu $(DEPS)
$(NVCC) $(ARCH) $(COMMON) --compiler-options "$(CFLAGS)" -c $< -o $#
$(OBJDIR):
mkdir -p $(OBJDIR)
backup:
mkdir -p backup
results:
mkdir -p results
setchmod:
chmod +x *.sh
.PHONY: clean
clean:
rm -rf $(OBJS) $(EXEC) $(LIBNAMESO) $(APPNAMESO)
ALL,
I'm trying to manually compile wxWidgets library - trying to add a new file source to it.
I successfully did compilation:
/Users/AlenaKorot/wxWidgets3.0/buildMac/bk-deps g++ -mmacosx-version-min=10.6 -c -o coredll_desktopenvcmn.o -I./.pch/wxprec_coredll -D__WXOSX_COCOA__ -DWXBUILDING -I/Users/AlenaKorot/wxWidgets3.0/buildMac/src/tiff/libtiff -I../src/tiff/libtiff -I../src/jpeg -I../src/png -I../src/regex -DWXUSINGDLL -DWXMAKINGDLL_CORE -DwxUSE_BASE=0 -dynamic -fPIC -DPIC -Wall -Wundef -Wunused-parameter -Wno-ctor-dtor-privacy -Woverloaded-virtual -Wno-deprecated-declarations -D_FILE_OFFSET_BITS=64 -I/Users/AlenaKorot/wxWidgets3.0/buildMac/lib/wx/include/osx_cocoa-unicode-3.0 -I../include -arch i386 -DWX_PRECOMP -ggdb -O0 -arch i386 -fno-common -fvisibility=hidden -fvisibility-inlines-hidden ../src/common/desktopenvcmn.cpp
/Users/AlenaKorot/wxWidgets3.0/buildMac/bk-deps g++ -mmacosx-version-min=10.6 -c -o coredll_osx_cocoa_desktopenv.o -I./.pch/wxprec_coredll -D__WXOSX_COCOA__ -DWXBUILDING -I/Users/AlenaKorot/wxWidgets3.0/buildMac/src/tiff/libtiff -I../src/tiff/libtiff -I../src/jpeg -I../src/png -I../src/regex -DWXUSINGDLL -DWXMAKINGDLL_CORE -DwxUSE_BASE=0 -dynamic -fPIC -DPIC -D_FILE_OFFSET_BITS=64 -I/Users/AlenaKorot/wxWidgets3.0/buildMac/lib/wx/include/osx_cocoa-unicode-3.0 -I../include -arch i386 -ggdb -O0 -arch i386 -fvisibility=hidden -fvisibility-inlines-hidden ../src/osx/cocoa/desktopenv.mm
And linking:
g++ -mmacosx-version-min=10.6 -dynamiclib -single_module -headerpad_max_install_names -o /Users/AlenaKorot/wxWidgets3.0/buildMac/lib/libwx_osx_cocoau_core-3.0.0.3.0.dylib coredll_desktopenvcmn.o coredll_osx_cocoa_desktopenv.o coredll_event.o coredll_fs_mem.o coredll_msgout.o coredll_utilscmn.o coredll_osx_cocoa_utils.o coredll_artmac.o coredll_osx_brush.o coredll_dialog_osx.o coredll_osx_fontutil.o coredll_osx_imaglist.o coredll_osx_minifram.o coredll_nonownedwnd_osx.o coredll_osx_palette.o coredll_osx_pen.o coredll_toplevel_osx.o coredll_uiaction_osx.o coredll_utils_osx.o coredll_window_osx.o coredll_core_bitmap.o coredll_core_colour.o coredll_core_dcmemory.o coredll_core_display.o coredll_core_fontenum.o coredll_hid.o coredll_printmac.o coredll_core_timer.o coredll_utilsexc_cf.o coredll_apptraits.o coredll_anybutton_osx.o coredll_bmpbuttn_osx.o coredll_button_osx.o coredll_checkbox_osx.o coredll_checklst_osx.o coredll_choice_osx.o coredll_combobox_osx.o coredll_dnd_osx.o coredll_gauge_osx.o coredll_listbox_osx.o coredll_menu_osx.o coredll_menuitem_osx.o coredll_notebook_osx.o coredll_printdlg_osx.o coredll_radiobox_osx.o coredll_radiobut_osx.o coredll_scrolbar_osx.o coredll_slider_osx.o coredll_spinbutt_osx.o coredll_srchctrl_osx.o coredll_statbox_osx.o coredll_statline_osx.o coredll_stattext_osx.o coredll_textentry_osx.o coredll_textctrl_osx.o coredll_tglbtn_osx.o coredll_toolbar_osx.o coredll_webkit.o coredll_colordlgosx.o coredll_fontdlgosx.o coredll_osx_accel.o coredll_carbon_clipbrd.o coredll_carbon_cursor.o coredll_carbon_fontdlg.o coredll_carbon_gdiobj.o coredll_carbon_icon.o coredll_carbon_app.o coredll_carbon_combobox.o coredll_carbon_control.o coredll_carbon_dataobj.o coredll_carbon_dcclient.o coredll_carbon_dcprint.o coredll_carbon_dcscreen.o coredll_glgrab.o coredll_carbon_graphics.o coredll_carbon_font.o coredll_carbon_frame.o coredll_carbon_mdi.o coredll_carbon_metafile.o coredll_carbon_overlay.o coredll_carbon_popupwin.o coredll_carbon_renderer.o coredll_carbon_settings.o coredll_statbrma.o coredll_carbon_region.o coredll_utilscocoa.o coredll_generic_caret.o coredll_clrpickerg.o coredll_collpaneg.o coredll_colrdlgg.o coredll_dirdlgg.o coredll_generic_fdrepdlg.o coredll_filedlgg.o coredll_filepickerg.o coredll_fontdlgg.o coredll_fontpickerg.o coredll_generic_listctrl.o coredll_prntdlgg.o coredll_generic_statusbr.o coredll_generic_textmeasure.o coredll_cocoa_anybutton.o coredll_osx_cocoa_button.o coredll_osx_cocoa_checkbox.o coredll_osx_cocoa_choice.o coredll_osx_cocoa_colour.o coredll_osx_cocoa_combobox.o coredll_osx_cocoa_dialog.o coredll_osx_cocoa_dirdlg.o coredll_cocoa_dnd.o coredll_osx_cocoa_evtloop.o coredll_osx_cocoa_filedlg.o coredll_osx_cocoa_gauge.o coredll_osx_cocoa_listbox.o coredll_osx_cocoa_menu.o coredll_osx_cocoa_menuitem.o coredll_osx_cocoa_msgdlg.o coredll_cocoa_nonownedwnd.o coredll_osx_cocoa_notebook.o coredll_osx_cocoa_radiobut.o coredll_preferences.o coredll_cocoa_printdlg.o coredll_osx_cocoa_scrolbar.o coredll_osx_cocoa_slider.o coredll_osx_cocoa_spinbutt.o coredll_cocoa_srchctrl.o coredll_osx_cocoa_statbox.o coredll_cocoa_statline.o coredll_osx_cocoa_stattext.o coredll_osx_cocoa_textctrl.o coredll_cocoa_tglbtn.o coredll_osx_cocoa_toolbar.o coredll_osx_cocoa_tooltip.o coredll_osx_cocoa_window.o coredll_accelcmn.o coredll_accesscmn.o coredll_anidecod.o coredll_affinematrix2d.o coredll_appcmn.o coredll_artprov.o coredll_artstd.o coredll_arttango.o coredll_bmpbase.o coredll_bmpbtncmn.o coredll_bookctrl.o coredll_btncmn.o coredll_cairo.o coredll_checkboxcmn.o coredll_checklstcmn.o coredll_choiccmn.o coredll_clipcmn.o coredll_clrpickercmn.o coredll_colourcmn.o coredll_colourdata.o coredll_combocmn.o coredll_cmdproc.o coredll_cmndata.o coredll_containr.o coredll_cshelp.o coredll_ctrlcmn.o coredll_ctrlsub.o coredll_dcbase.o coredll_dcbufcmn.o coredll_dcgraph.o coredll_dcsvg.o coredll_dirctrlcmn.o coredll_dlgcmn.o coredll_dndcmn.o coredll_dobjcmn.o coredll_docmdi.o coredll_docview.o coredll_dpycmn.o coredll_dseldlg.o coredll_effects.o coredll_fddlgcmn.o coredll_filectrlcmn.o coredll_filehistorycmn.o coredll_filepickercmn.o coredll_fontpickercmn.o coredll_fldlgcmn.o coredll_fontcmn.o coredll_fontdata.o coredll_graphicc.o coredll_fontenumcmn.o coredll_fontmap.o coredll_fontutilcmn.o coredll_framecmn.o coredll_gaugecmn.o coredll_gbsizer.o coredll_gdicmn.o coredll_geometry.o coredll_gifdecod.o coredll_graphcmn.o coredll_headercolcmn.o coredll_headerctrlcmn.o coredll_helpbase.o coredll_iconbndl.o coredll_imagall.o coredll_imagbmp.o coredll_image.o coredll_imagfill.o coredll_imaggif.o coredll_imagiff.o coredll_imagjpeg.o coredll_imagpcx.o coredll_imagpng.o coredll_imagpnm.o coredll_imagtga.o coredll_imagtiff.o coredll_imagxpm.o coredll_layout.o coredll_lboxcmn.o coredll_listctrlcmn.o coredll_markupparser.o coredll_matrix.o coredll_menucmn.o coredll_modalhook.o coredll_mousemanager.o coredll_nbkbase.o coredll_overlaycmn.o coredll_ownerdrwcmn.o coredll_paper.o coredll_panelcmn.o coredll_persist.o coredll_pickerbase.o coredll_popupcmn.o coredll_preferencescmn.o coredll_prntbase.o coredll_quantize.o coredll_radiobtncmn.o coredll_radiocmn.o coredll_rearrangectrl.o coredll_rendcmn.o coredll_rgncmn.o coredll_scrolbarcmn.o coredll_settcmn.o coredll_sizer.o coredll_slidercmn.o coredll_spinbtncmn.o coredll_spinctrlcmn.o coredll_srchcmn.o coredll_statbar.o coredll_statbmpcmn.o coredll_statboxcmn.o coredll_statlinecmn.o coredll_stattextcmn.o coredll_stockitem.o coredll_tbarbase.o coredll_textcmn.o coredll_textentrycmn.o coredll_textmeasurecmn.o coredll_toplvcmn.o coredll_treebase.o coredll_uiactioncmn.o coredll_valgen.o coredll_validate.o coredll_valtext.o coredll_valnum.o coredll_wincmn.o coredll_windowid.o coredll_wrapsizer.o coredll_xpmdecod.o coredll_busyinfo.o coredll_buttonbar.o coredll_choicdgg.o coredll_choicbkg.o coredll_combog.o coredll_dcpsg.o coredll_dirctrlg.o coredll_dragimgg.o coredll_filectrlg.o coredll_headerctrlg.o coredll_generic_infobar.o coredll_listbkg.o coredll_logg.o coredll_markuptext.o coredll_msgdlgg.o coredll_numdlgg.o coredll_progdlgg.o coredll_preferencesg.o coredll_printps.o coredll_renderg.o coredll_richmsgdlgg.o coredll_scrlwing.o coredll_selstore.o coredll_spinctlg.o coredll_splitter.o coredll_srchctlg.o coredll_statbmpg.o coredll_stattextg.o coredll_textdlgg.o coredll_tipwin.o coredll_toolbkg.o coredll_treectlg.o coredll_treebkg.o coredll_vlbox.o coredll_vscroll.o coredll_xmlreshandler.o -L/Users/AlenaKorot/wxWidgets3.0/buildMac/lib -L/Users/AlenaKorot/wxWidgets3.0/buildMac/lib -install_name /usr/local/lib/libwx_osx_cocoau_core-3.0.0.dylib -compatibility_version 4.0 -current_version 4.0 -arch i386 -framework IOKit -framework Carbon -framework Cocoa -framework AudioToolbox -framework System -framework OpenGL -lwxtiff-3.0 -lwxjpeg-3.0 -lwxpng-3.0 -framework WebKit -lwxregexu-3.0 -arch i386 -framework IOKit -framework Carbon -framework Cocoa -framework AudioToolbox -framework System -framework OpenGL -lz -lpthread -liconv -lwx_baseu-3.0 -lz -lpthread -liconv
Now, here is the strange thing:
Alena-Korots-MacBook:buildMac AlenaKorot$ nm -g coredll_osx_cocoa_desktopenv.o | grep -i desktopenv000001ca T __ZN12wxDesktopEnv15MoveFileToTrashERK8wxString
00019dc8 S __ZN12wxDesktopEnv15MoveFileToTrashERK8wxString.eh
00000444 T __ZN12wxDesktopEnv20MoveDirectoryToTrashERK8wxString
00019df8 S __ZN12wxDesktopEnv20MoveDirectoryToTrashERK8wxString.eh
000000aa T __ZN12wxDesktopEnv20MoveFileToRecycleBinERK8wxString
00019c10 S __ZN12wxDesktopEnv20MoveFileToRecycleBinERK8wxString.eh
0000015a T __ZN12wxDesktopEnvC1Ev
00000000 T __ZN12wxDesktopEnvC2Ev
00000070 T __ZN12wxDesktopEnvD0Ev
00000036 T __ZN12wxDesktopEnvD1Ev
00000190 T __ZN12wxDesktopEnvD2Ev
U __ZN16wxDesktopEnvBase20MoveFileToRecycleBinERK8wxString
0001976c S __ZN16wxDesktopEnvBaseC2Ev
00019ba0 S __ZTI12wxDesktopEnv
U __ZTI16wxDesktopEnvBase
00019b5a S __ZTS12wxDesktopEnv
00019b88 S __ZTV12wxDesktopEnv
U __ZTV16wxDesktopEnvBase
In the object file there are wxDesktopEnv constructor and wxDesktopEnvBase constructor. However:
Alena-Korots-MacBook:lib AlenaKorot$ nm -g libwx_osx_cocoau_core-3.0.dylib | grep -i desktop
Alena-Korots-MacBook:lib AlenaKorot$
those symbols are missing from the dylib.
As you can see I'm linking against the appropriate *.o files.
What do I do to fix it? And where my symbols are?
Thank you.
P.S.: Sorry for such a long post with a bit code quote.
Problem solved.
I tried to do the build with mixed directories.
Sorry for the noise.
I know, that there were many questions similar to mine, but their answers didn't solve my problem.
I am trying to build the CHamsa project:
https://github.com/maxsnew/CHamsa/
Got sary, patched it, built, installed. Built the TokenEXAPI. All was great.
When finally made the CHamsa with a makefile, it gave me errors:
Makefile after typing 'make'
g++ -o siggen tracesary.o utils.o tokenExtract.o conjpattern.o sig_gen.o siggen_main.o
-lm -pthread -L/usr/local/lib -lsary -lgthread-2.0 -lglib-2.0 -LTokenEXAPI -ltkex -lds_ssort -lbwtlcp
errors
/usr/local/lib/libsary.so: undefined reference to `g_free'
/usr/local/lib/libsary.so: undefined reference to `g_hash_table_destroy'
/usr/local/lib/libsary.so: undefined reference to `g_strdup'
/usr/local/lib/libsary.so: undefined reference to `g_hash_table_insert'
/usr/local/lib/libsary.so: undefined reference to `g_strconcat'
/usr/local/lib/libsary.so: undefined reference to `g_array_new'
/usr/local/lib/libsary.so: undefined reference to `g_array_free'
/usr/local/lib/libsary.so: undefined reference to `g_malloc'
/usr/local/lib/libsary.so: undefined reference to `g_assertion_message_expr'
/usr/local/lib/libsary.so: undefined reference to `g_hash_table_new'
/usr/local/lib/libsary.so: undefined reference to `g_hash_table_foreach'
/usr/local/lib/libsary.so: undefined reference to `g_hash_table_lookup'
/usr/local/lib/libsary.so: undefined reference to `g_strerror'
/usr/local/lib/libsary.so: undefined reference to `g_malloc_n'
/usr/local/lib/libsary.so: undefined reference to `g_array_append_vals'
/usr/local/lib/libsary.so: undefined reference to `g_log'
it looks like badly linked, because the file, which is using the glib has got:
#include <glib.h>
any ideas how can I solve this one? I am sitting here whole day googling for answers...
this one was bad:
g++ -o siggen tracesary.o utils.o tokenExtract.o conjpattern.o sig_gen.o siggen_main.o
-lm -pthread -lgthread-2.0 -lglib-2.0 -L/usr/local/lib -lsary -LTokenEXAPI -ltkex -lds_ssort -lbwtlcp
that one too:
g++ -o siggen tracesary.o utils.o tokenExtract.o conjpattern.o sig_gen.o siggen_main.o
-lm -pthread -lgthread-2.0 -lglib-2.0 -L/usr/local/lib -lsary -LTokenEXAPI -ltkex -lds_ssort -lbwtlcp
even that one:
g++ -o siggen tracesary.o utils.o tokenExtract.o conjpattern.o sig_gen.o siggen_main.o
-lm -pthread -L/usr/local/lib -lsary -L/usr/lib -lgthread-2.0 -lglib-2.0 -LTokenEXAPI -ltkex -lds_ssort -lbwtlcp
EDIT
Makefile looks like that:
###############################################################################
#
# File: Makefile
# Description: Guess
# Author: Zhichun Li
# Northwestern Systems Research Group
# Department of Computer Science
# Northwestern University
# Language: Makefile
# Package: N/A
# Status: Experimental (Do Not Distribute)
#
# (C) Copyright 2006, Northwestern University, all rights reserved.
#
###############################################################################
CXX = g++
MV = mv
CP = cp
RM = rm
MKDIR = mkdir
TAR = tar cvf
COMPRESS = gzip
INC = $(shell pkg-config --cflags sary)
#CXXFLAGS = -Wall -ggdb -c ${INC}
CXXFLAGS = -Wall -O3 -c ${INC}
LIBS = -lm $(shell pkg-config --libs sary) -LTokenEXAPI -ltkex -lds_ssort -lbwtlcp
TARGET = test_tracesary
TARGET = siggen
STATICLIBS =
SOURCES = test_tracesary.cpp tracesary.cpp utils.cpp
SOURCES = siggen_main.cpp tracesary.cpp utils.cpp tokenExtract.cpp conjpattern.cpp sig_gen.cpp
SOURCES = tracesary.cpp utils.cpp tokenExtract.cpp conjpattern.cpp sig_gen.cpp
HEADER = utils.h tracesary.h bitvec.h globals.h
OBJS = ${SOURCES:.cpp=.o}
all: ${TARGET} siggen_nonoise
#utils.o: utils.cpp ${HEADER}
# ${CXX} ${CXXFLAGS} $<
#tracesary.o: tracesary.cpp ${HEADER}
# ${CXX} ${CXXFLAGS} $<
#test_tracesary.o: test_tracesary.cpp ${HEADER}
# ${CXX} ${CXXFLAGS} $<
#siggen.o: sigen.cpp ${HEADER}
# ${CXX} ${CXXFLAGS} $<
${TARGET}: siggen_main.o ${OBJS}
${CXX} -o $# ${OBJS} siggen_main.o ${LIBS}
siggen_nonoise: siggen_nonoise.o ${OBJS}
${CXX} -o $# ${OBJS} siggen_nonoise.o ${LIBS}
%.o: %.cpp *.h
$(CXX) $(CXXFLAGS) -c $< -o $#
clean:
${RM} -f *.o *~ ${TARGET} siggen_nonoise
cleanAll: clean
and I also tried it with
$(shell pkg-config --libs glib-2.0)
with no effect
I know I can run qmake from the command line and use:
-spec linux-g++-32
From the .pro file i've tried to add alternatively "-m32" or "-32" to "CFLAGS" or "QMAKE_CXXFLAGS" but it does not work.
CFLAGS += -m32
QMAKE_CXXFLAGS += -m32
What shall I do then ?
EDIT:
this is what is produced with the above flag...
g++ -c -pipe -m32 -g -Wall -W -D_REENTRANT -DQT_XMLPATTERNS_LIB -DQT_XML_LIB -DQT_CORE_LIB -DQT_SHARED -I/Soft/fox_dev/Qt-4.7.4/mkspecs/linux-g++ -I../fxa_march -I/Soft/fox_dev/Qt-4.7.4/include/QtCore -I/Soft/fox_dev/Qt-4.7.4/include/QtXml -I/Soft/fox_dev/Qt-4.7.4/include/QtXmlPatterns -I/Soft/fox_dev/Qt-4.7.4/include -I../../../fx/libfx -I../../../fx/MQLib -I/Soft/fox_dev/boost/boost_1_54_0 -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I. -I../fxa_march -I. -o fxa_march.o ../fxa_march/fxa_march.cpp
g++ -c -pipe -m32 -g -Wall -W -D_REENTRANT -DQT_XMLPATTERNS_LIB -DQT_XML_LIB -DQT_CORE_LIB -DQT_SHARED -I/Soft/fox_dev/Qt-4.7.4/mkspecs/linux-g++ -I../fxa_march -I/Soft/fox_dev/Qt-4.7.4/include/QtCore -I/Soft/fox_dev/Qt-4.7.4/include/QtXml -I/Soft/fox_dev/Qt-4.7.4/include/QtXmlPatterns -I/Soft/fox_dev/Qt-4.7.4/include -I../../../fx/libfx -I../../../fx/MQLib -I/Soft/fox_dev/boost/boost_1_54_0 -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I. -I../fxa_march -I. -o reports.o ../fxa_march/reports.cpp
g++ -c -pipe -m32 -g -Wall -W -D_REENTRANT -DQT_XMLPATTERNS_LIB -DQT_XML_LIB -DQT_CORE_LIB -DQT_SHARED -I/Soft/fox_dev/Qt-4.7.4/mkspecs/linux-g++ -I../fxa_march -I/Soft/fox_dev/Qt-4.7.4/include/QtCore -I/Soft/fox_dev/Qt-4.7.4/include/QtXml -I/Soft/fox_dev/Qt-4.7.4/include/QtXmlPatterns -I/Soft/fox_dev/Qt-4.7.4/include -I../../../fx/libfx -I../../../fx/MQLib -I/Soft/fox_dev/boost/boost_1_54_0 -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I. -I../fxa_march -I. -o fxa_march_params.o ../fxa_march/fxa_march_params.cpp
g++ -c -pipe -m32 -g -Wall -W -D_REENTRANT -DQT_XMLPATTERNS_LIB -DQT_XML_LIB -DQT_CORE_LIB -DQT_SHARED -I/Soft/fox_dev/Qt-4.7.4/mkspecs/linux-g++ -I../fxa_march -I/Soft/fox_dev/Qt-4.7.4/include/QtCore -I/Soft/fox_dev/Qt-4.7.4/include/QtXml -I/Soft/fox_dev/Qt-4.7.4/include/QtXmlPatterns -I/Soft/fox_dev/Qt-4.7.4/include -I../../../fx/libfx -I../../../fx/MQLib -I/Soft/fox_dev/boost/boost_1_54_0 -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I. -I../fxa_march -I. -o reportgroup.o ../fxa_march/reportgroup.cpp
g++ -c -pipe -m32 -g -Wall -W -D_REENTRANT -DQT_XMLPATTERNS_LIB -DQT_XML_LIB -DQT_CORE_LIB -DQT_SHARED -I/Soft/fox_dev/Qt-4.7.4/mkspecs/linux-g++ -I../fxa_march -I/Soft/fox_dev/Qt-4.7.4/include/QtCore -I/Soft/fox_dev/Qt-4.7.4/include/QtXml -I/Soft/fox_dev/Qt-4.7.4/include/QtXmlPatterns -I/Soft/fox_dev/Qt-4.7.4/include -I../../../fx/libfx -I../../../fx/MQLib -I/Soft/fox_dev/boost/boost_1_54_0 -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I. -I../fxa_march -I. -o db_wrapper.o ../fxa_march/db_wrapper.cpp
../fxa_march/db_wrapper.cpp: In function 'std::string as_string(FX::dbvalue, FX::dbtype)':
../fxa_march/db_wrapper.cpp:17: warning: enumeration value 'dbtype_dbvoid' not handled in switch
../fxa_march/db_wrapper.cpp:17: warning: enumeration value 'dbtype_dbdate' not handled in switch
../fxa_march/db_wrapper.cpp:17: warning: enumeration value 'dbtype_dbmoney' not handled in switch
g++ -Wl,-rpath,/Soft/fox_dev/Qt-4.7.4/lib -o fxa_march fxa_march.o reports.o fxa_march_params.o reportgroup.o db_wrapper.o -L/Soft/fox_dev/Qt-4.7.4/lib -L../../../fx/libfx -lfx -L../../../fx/MQLib -lMQ -L/Soft/fox_dev/boost/boost_bin/lib -lboost_timer -lboost_system -lboost_chrono -lboost_regex -L/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/lib -lxerces-c -lQtXmlPatterns -L/Soft/fox_dev/Qt-4.7.4/lib -lQtNetwork -lQtXml -lQtCore -lpthread
/usr/bin/ld: skipping incompatible ../../../fx/libfx/libfx.so when searching for -lfx
/usr/bin/ld: cannot find -lfx
collect2: ld returned 1 exit status
make: *** [fxa_march] Error 1
Ok, here is the point:
the diff between the generated makefile ( through QtCreator ) and the one generated by my command line is:
INCPATH = -I/Soft/fox_dev/Qt-4.7.4/mkspecs/linux-g++-32 -I. -I/Soft/fox_dev/Qt-4.7.4/include/QtCore -I/Soft/fox_dev/Qt-4.7.4/include/QtXml -I/Soft/fox_dev/Qt-4.7.4/include/QtXmlPatterns -I/Soft/fox_dev/Qt-4.7.4/include -I../../../fx/libfx -I../../../fx/MQLib -I/Soft/fox_dev/boost/boost_1_54_0 -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I.
Vs
INCPATH = -I/Soft/fox_dev/Qt-4.7.4/mkspecs/linux-g++ -I../fxa_march -I/Soft/fox_dev/Qt-4.7.4/include/QtCore -I/Soft/fox_dev/Qt-4.7.4/include/QtXml -I/Soft/fox_dev/Qt-4.7.4/include/QtXmlPatterns -I/Soft/fox_dev/Qt-4.7.4/include -I../../../fx/libfx -I../../../fx/MQLib -I/Soft/fox_dev/boost/boost_1_54_0 -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I. -I../fxa_march -I.
however one can go to "Project-> Build Settings -> [choose configuration to modify] -> And edit the "Qmake step" with additionnal argument:
-spec linux-g++-32
you will also need to add in the .pro file either of:
CFLAGS += -m32
QMAKE_CXXFLAGS += -m32
In .pro file, try writting all commands inside a scope prefixed by win32
win32 {
SOURCES += paintwidget_win.cpp
# ...
}
Commands inside the scope will be run only if the win32 variable is set.