Undefined symbols for architecture x86_64 buiding on Netbeans - c++

I am trying to create a simple Fix client-server using QuickFix and I have tried to implement QuickFix.Application interface.
During the building I have faced this problem : "Undefined symbols for architecture x86_64" and despite I have already read all the relative answers to this question and trying everything suggested I have still the above issue.
I am using Netbeans and C++, and this is the error I got
g++ -o dist/Debug/GNU-MacOSX/fix_engine_server build/Debug/GNU-MacOSX/Application.o build/Debug/GNU-MacOSX/main.o -lstdc++
Undefined symbols for architecture x86_64:
"FIX::Message::toString(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, int, int, int) const", referenced from:
FIX::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, FIX::Message const&) in Application.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [dist/Debug/GNU-MacOSX/fix_engine_server] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
On Netbeans->preferences->C/C++->C++_Compiler : /usr/bin/g++
On Property->Linker->Additional_Options : -lstdc++
On Property->Linker->Tool : g++
Any suggestion ?

Related

Unable to run code on CLion on my Mac. I am receiving the error message "This file does not belong to any project target"

I am new to using CLion and am trying to build my first project. I have two source files (main.cpp and Hero.cpp) and a header for Hero.cpp. At the top of Hero.cpp there is a yellow banner that reads "This file does not belong to any project target; code insight features might not work properly." I am pretty sure there are no mistakes with regard to the syntax or logic of the program. However, when I try to run my code, I get:
[ 50%] Building CXX object CMakeFiles/untitled.dir/main.cpp.o
[100%] Linking CXX executable untitled
Undefined symbols for architecture x86_64:
"Hero::GetStrength()", referenced from:
PrintHero(Hero) in main.cpp.o
"Hero::GetHitpoints()", referenced from:
PrintHero(Hero) in main.cpp.o
"Hero::GetName()", referenced from:
PrintHero(Hero) in main.cpp.o
"Hero::Hero(std::__1::basic_string<char, std::__1::char_traits<char>,
std::__1::allocator<char> >, int, int)", referenced from:
_main in main.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [untitled] Error 1
make[2]: *** [CMakeFiles/untitled.dir/all] Error 2
make[1]: *** [CMakeFiles/untitled.dir/rule] Error 2
make: *** [untitled] Error 2
Could somebody help me figure out this problem? Thanks in advance!

Undefined symbols for arcitecture x86_64 when I try to use GRANSAC code from github

I'm trying to use GRANSAC(Generic RANSAC) from this github repository. https://github.com/drsrinathsridhar/GRANSAC
When I build with cmake, this error happens and I don't know how to solve it.
Undefined symbols for architecture x86_64: "_omp_get_max_threads",
referenced from:
GRANSAC::RANSAC::Estimate(std::__1::vector,
std::__1::allocator >
const&) in LineFittingSample.cpp.o
GRANSAC::RANSAC::RANSAC() in LineFittingSample.cpp.o "_omp_get_thread_num", referenced from:
GRANSAC::RANSAC::Estimate(std::__1::vector,
std::__1::allocator >
const&) in LineFittingSample.cpp.o "_omp_set_dynamic", referenced from:
GRANSAC::RANSAC::Estimate(std::__1::vector,
std::__1::allocator >
const&) in LineFittingSample.cpp.o "_omp_set_num_threads", referenced from:
GRANSAC::RANSAC::Estimate(std::__1::vector,
std::__1::allocator >
const&) in LineFittingSample.cpp.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code
1 (use -v to see invocation) make[2]: * [LineFittingSample] Error 1
make[1]: * [CMakeFiles/LineFittingSample.dir/all] Error 2 make: ***
[all]
Error 2
Environment: MacOS Mojave ver 10.14.16

C++ Spline Example from ALGLIB not compiling on MacOS [duplicate]

This question already has answers here:
What is an undefined reference/unresolved external symbol error and how do I fix it?
(39 answers)
Closed 3 years ago.
I am trying to compile and run the spline1d_d example from ALGLIB web page on MACOS using C++ Version 14 and cmake Version 3.14.
(code is here: http://www.alglib.net/translator/man/manual.cpp.html#example_spline1d_d_cubic)
The compiler throws the below error message.
Can please somebody help?
Includes from ALGLIB are being found as expected:
include
include
The COMPILER ERROR MESSAGE:
/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake --build /Users/peter/CLionProjects/test_scripts/cmake-build-debug --target test_scripts -- -j 4
Scanning dependencies of target test_scripts
[ 50%] Building CXX object CMakeFiles/test_scripts.dir/main.cpp.o
[100%] Linking CXX executable test_scripts
Undefined symbols for architecture x86_64:
"alglib::spline1dgriddiffcubic(alglib::real_1d_array const&, alglib::real_1d_array const&, alglib::real_1d_array&, alglib::xparams)", referenced from:
_main in main.cpp.o
"alglib::spline1dgriddiff2cubic(alglib::real_1d_array const&, alglib::real_1d_array const&, alglib::real_1d_array&, alglib::real_1d_array&, alglib::xparams)", referenced from:
_main in main.cpp.o
"alglib::xdefault", referenced from:
_main in main.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [test_scripts] Error 1
make[2]: *** [CMakeFiles/test_scripts.dir/all] Error 2
make[1]: *** [CMakeFiles/test_scripts.dir/rule] Error 2
make: *** [test_scripts] Error 2
I think your using the wrong architecture. 64 bit or 32 bit.
Another error about linking in c++ is that you didn't add reference path to c++ header files in project settings

OpenEXR linker error when 'half' type is assigned

I'm having an issue assigning values to an Imf::Rgba struct containing half types as defined by OpenEXR. There appears to be a linker error that concerns the conversion from float to half.
Linking CXX executable graphics-env
Undefined symbols for architecture x86_64:
"half::_eLut", referenced from:
half::half(float) in main.cpp.o
"half::convert(int)", referenced from:
half::half(float) in main.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [graphics-env] Error 1
make[1]: *** [CMakeFiles/graphics-env.dir/all] Error 2
make: *** [all] Error 2
I believe this is a common problem on windows and that OPENEXR_DLL needs to be defined. This does not work however as I am compiling on OS X. I have tried linking to libIlmImf.dylib and libIlmImf.a with the same result. The version of OpenEXR being used is 2.2.0 and installed using Homebrew.
These symbols are defined in half.h that is part of IlmBase.
You should link to libHalf.dylib.

"undefined symbols for architecture" linker error when compiling a Qt tutorial

I am getting an error when trying to compile my QT app on Mac.
I followed this tutorial all the code is at the bottom of the page.
When I build the project I get the following:
Undefined symbols for architecture x86_64:
"DiagramItem::addArrow(Arrow*)", referenced from:
DiagramScene::mouseReleaseEvent(QGraphicsSceneMouseEvent*) in diagramscene.o
"DiagramScene::setItemType(DiagramItem::DiagramType)", referenced from:
MainWindow::buttonGroupClicked(int) in mainwindow.o
DiagramScene::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) in moc_diagramscene.o
"DiagramScene::setTextColor(QColor const&)", referenced from:
MainWindow::textButtonTriggered() in mainwindow.o
"DiagramScene::setMode(DiagramScene::Mode)", referenced from:
MainWindow::buttonGroupClicked(int) in mainwindow.o
MainWindow::pointerGroupClicked(int) in mainwindow.o
MainWindow::itemInserted(DiagramItem*) in mainwindow.o
MainWindow::textInserted(QGraphicsTextItem&) in mainwindow.o
DiagramScene::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) in moc_diagramscene.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [DiagramScene.app/Contents/MacOS/DiagramScene] Error 1
18:41:52: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project DiagramScene (kit: Desktop)
When executing step 'Make'
Anyone seen this before or any suggestions?
Thanks in advance. :)
The linker is telling you exactly what's happening. There are no implementations provided for the methods that are listed, namely for:
DiagramItem::addArrow(Arrow*)
DiagramScene::setItemType(DiagramItem::DiagramType)
DiagramScene::setTextColor(QColor const&)
DiagramScene::setMode(DiagramScene::Mode)
Simply write the implementations of those methods. The example might be incomplete if you were copy-pasting the code from the help page.