I am new to macbook and apple computers in general, so I'm having a hard time making macbook pro recognize GLEW and GLFW. I installed both libraries with no problem, my includes are as follows: /usr/include/GL for glew.h, glxew.h and wglew.h. /usr/lib/ contains libGLEW.a the include and lib files for GLFW are in /usr/local/ I am using vim as a text editor and have a simple main.cpp program but it gives me an error that the glew.h cannot be found, any ideas why this is happening and how should I fix it?
#include <GL/glew.h>
#define GLFW_DLL
#include <GLFW/glfw3.h>
#include <stdio.h>
int main()
{
if (!glfwInit())
{
fprintf (stderr, "ERROR: could not start GLFW\n");
return 1;
}
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
GLFWwindow* window = glfwCreateWindow (640, 480, "Hello Shaders", NULL, NULL);
if (!window)
{ fprintf(stderr, "ERROR: could not openwindow with GLFW3\n");
glgwTerminate();
return 1;
}
glfwMakeContextCurrent (window);
glewExperimantal = GL_TRUE;
glewInit();
const GLubyte* renderer = glGetString(GL_RENDERER);
const GLubyte* version = glGetString(GL_VERSION);
printf("Renderer: %s\n", renderer);
printf("OpenGL version supported %s\n", version);
glEnable (DEPTH_TEST);
glDepthFunc (GL_LESS);
glfwTerminate();
return 0;
}
I am compiling with:
g++ -framework Cocoa -framework OpenGL -framework IOKit -o demo main.cpp -I include -I/sw/include -I/usr/local/include /usr/lib/libGLEW.a /usr/local/lib/libglfw3.a
Edit: moving the GL includes to /usr/local fixed compilation errors but now I get a linker error, any idea what can be done here?
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.10.0 -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name main.cpp -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 241.9 -v -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -I include -I /sw/include -I /usr/local/include -stdlib=libc++ -fdeprecated-macro -fdebug-compilation-dir /Users/yuri13/Documents/shaders -ferror-limit 19 -fmessage-length 80 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.10.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp -o /var/folders/b4/j5zrzg_n7hb205xs22z5f4qc0000gp/T/main-ea70be.o -x c++ main.cpp
clang -cc1 version 6.0 based upon LLVM 3.5svn default target x86_64-apple-darwin14.0.0
ignoring nonexistent directory "include"
ignoring nonexistent directory "/sw/include"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/c++/v1"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/local/include"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks (framework directory)
End of search list.
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.10.0 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -o demo -framework Cocoa -framework OpenGL -framework IOKit /var/folders/b4/j5zrzg_n7hb205xs22z5f4qc0000gp/T/main-ea70be.o /usr/lib/libGLEW.a /usr/local/lib/libglfw3.a -lc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/lib/darwin/libclang_rt.osx.a
Undefined symbols for architecture x86_64:
"_CVDisplayLinkCreateWithCGDisplay", referenced from:
__glfwPlatformGetVideoModes in libglfw3.a(cocoa_monitor.m.o)
__glfwPlatformGetVideoMode in libglfw3.a(cocoa_monitor.m.o)
"_CVDisplayLinkGetNominalOutputVideoRefreshPeriod", referenced from:
_vidmodeFromCGDisplayMode in libglfw3.a(cocoa_monitor.m.o)
"_CVDisplayLinkRelease", referenced from:
__glfwPlatformGetVideoModes in libglfw3.a(cocoa_monitor.m.o)
__glfwPlatformGetVideoMode in libglfw3.a(cocoa_monitor.m.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
If you get an error related to including the header file, the compiler cannot find the header. You can pass the -v flag to GCC (incl. g++) or Clang (incl. clang++) to see information about where it’s looking for it.
As this forum post explains, if you receive these link errors:
Undefined symbols for architecture x86_64:
"_CVDisplayLinkCreateWithCGDisplay", referenced from:
__glfwPlatformGetVideoModes in libglfw3.a(cocoa_monitor.m.o)
__glfwPlatformGetVideoMode in libglfw3.a(cocoa_monitor.m.o)
"_CVDisplayLinkGetNominalOutputVideoRefreshPeriod", referenced from:
_vidmodeFromCGDisplayMode in libglfw3.a(cocoa_monitor.m.o)
"_CVDisplayLinkRelease", referenced from:
__glfwPlatformGetVideoModes in libglfw3.a(cocoa_monitor.m.o)
__glfwPlatformGetVideoMode in libglfw3.a(cocoa_monitor.m.o)
ld: symbol(s) not found for architecture x86_64
Then you probably need to link with the CoreVideo framework. If you’re compiling on the command line, you can use -framework CoreVideo.
Related
I am trying to use CGAL in a project. I have installed CGAL using brew:
brew install cgal
Then, I tried to run some simple code. I am trying to run the first code of this webpage:
https://doc.cgal.org/4.7-beta1/Manual/introduction.html
I have tried to compile the code using the following command:
g++ -lcgal points_and_segment.cpp -o points_and_segment
But I am getting this error:
Undefined symbols for architecture x86_64:
"boost::detail::get_tss_data(void const*)", referenced from:
boost::thread_specific_ptr<double>::get() const in points_and_segment-78cb9a.o
"boost::detail::set_tss_data(void const*, boost::shared_ptr<boost::detail::tss_cleanup_function>, void*, bool)", referenced from:
boost::thread_specific_ptr<double>::reset(double*) in points_and_segment-78cb9a.o
boost::thread_specific_ptr<double>::~thread_specific_ptr() in points_and_segment-78cb9a.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have tried to include -lboost or -lboost_thread in the command. But then I am getting the following errors:
ld: library not found for -lboost
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ld: library not found for -lboost_thread
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have tried the same with -v. Then I get the following:
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
"/Library/Developer/CommandLineTools/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.11.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name points_and_segment.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 274.2 -v -dwarf-column-info -debugger-tuning=lldb -resource-dir /Library/Developer/CommandLineTools/usr/bin/../lib/clang/8.0.0 -stdlib=libc++ -fdeprecated-macro -fdebug-compilation-dir /Users/abureyanahmed/cgal_test -ferror-limit 19 -fmessage-length 143 -stack-protector 1 -fblocks -fobjc-runtime=macosx-10.11.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -o /var/folders/vf/b6nrfcl95l56768gldg25r1m0000gn/T/points_and_segment-c5ee94.o -x c++ points_and_segment.cpp
clang -cc1 version 8.0.0 (clang-800.0.42.1) default target x86_64-apple-darwin15.6.0
ignoring nonexistent directory "/usr/include/c++/v1"
#include "..." search starts here:
#include <...> search starts here:
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1
/usr/local/include
/Library/Developer/CommandLineTools/usr/bin/../lib/clang/8.0.0/include
/Library/Developer/CommandLineTools/usr/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.
"/Library/Developer/CommandLineTools/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.11.0 -o points_and_segment -lcgal -lboost /var/folders/vf/b6nrfcl95l56768gldg25r1m0000gn/T/points_and_segment-c5ee94.o -lc++ -lSystem /Library/Developer/CommandLineTools/usr/bin/../lib/clang/8.0.0/lib/darwin/libclang_rt.osx.a
ld: library not found for -lboost
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have looked for the cgal installation folder. It is the following path in my machine:
cd /usr/local/opt/cgal/
The folder for boost is:
cd /usr/local/opt/boost/
.brew/ INSTALL_RECEIPT.json include/ lib/
I struggled with this too. This website helped:
https://discourse.brew.sh/t/could-not-link-to-boost/2125/4
I have installed OpenMP and xcode-select in my macos.
$ clang-omp --version
clang version 3.5.0
Target: x86_64-apple-darwin15.4.0
Thread model: posix
$ xcode-select --version
xcode-select version 2343.
While running following pretty simple code
1 #include <omp.h>
2 #include <stdio.h>
3
4 #define n 20
5
6 int main(){
7
8 int i;
9 int tid;
10
11 omp_set_num_threads(3);
12 #pragma omp parallel for private(tid) schedule(static,1)
13
14 for (i=0; i<n; i++) {
15 tid = omp_get_thread_num();
16 printf("Thread %d executing iteration %d\n", tid, i);
17 }
18 }
I get error
$ clang-omp -openmp parallel.c -v
clang version 3.5.0
Target: x86_64-apple-darwin15.4.0
Thread model: posix
"/usr/local/Cellar/clang-omp/2015-04-01/libexec/bin/clang-3.5" -cc1 -triple x86_64-apple-macosx10.11.0 -emit-obj -mrelax-all -disable-free -main-file-name parallel.c -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -v -dwarf-column-info -resource-dir /usr/local/Cellar/clang-omp/2015-04-01/libexec/bin/../lib/clang/3.5.0 -fdebug-compilation-dir /Users/prayagupd/prayag.data/workspace.programming/parallel-programming/openMP -ferror-limit 19 -fmessage-length 178 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.11.0 -fencode-extended-block-signature -fdiagnostics-show-option -fcolor-diagnostics -o /var/folders/63/jvvb4wy16gx6w76mkgsvn52m0000gn/T/parallel-32b98e.o -x c parallel.c
clang -cc1 version 3.5.0 based upon LLVM 3.5.0svn default target x86_64-apple-darwin15.4.0
ignoring nonexistent directory "/usr/local/Cellar/clang-omp/2015-04-01/libexec/usr/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/local/Cellar/clang-omp/2015-04-01/libexec/bin/../lib/clang/3.5.0/include
/usr/local/opt/libiomp/include/libiomp
/usr/local/Cellar/clang-omp/2015-04-01/libexec/include/c++/v1
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.
"/usr/bin/ld" -dynamic -arch x86_64 -macosx_version_min 10.11.0 -o penmp /var/folders/63/jvvb4wy16gx6w76mkgsvn52m0000gn/T/parallel-32b98e.o -lSystem
Undefined symbols for architecture x86_64:
"_omp_get_thread_num", referenced from:
_main in parallel-32b98e.o
"_omp_set_num_threads", referenced from:
_main in parallel-32b98e.o
ld: symbol(s) not found for architecture x86_64
clang-3.5: error: linker command failed with exit code 1 (use -v to see invocation)
gcc doesn't even find omp.h.
$ gcc parallel.c -fopenmp -o parallel
parallel.c:1:10: fatal error: 'omp.h' file not found
#include <omp.h>
^
1 error generated.
gcc version is
$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin15.4.0
Thread model: posix
For your clang-omp issue, did you export the library path? ala
export DYLD_LIBRARY_PATH=(OMPLIB PATH):$DYLD_LIBRARY_PATH
Maybe you didn't install the OpenMP library from Intel? Modern clang(>3.7), that isn't packaged with OS X, now supports OpenMP out of the box.
For your gcc issue, OS X doesn't actually provide gcc, it just links it to vanilla clang. So you are trying to compile it with a compiler which doesn't support OpenMP. If you want gcc, then install it via ports or homebrew.
I’m writing some unit tests for a dynamic library on OS X. The dynamic library is in ../MathDll. The library itself is built via the following Makefile:
all: math.dylib
math.dylib: MathDll.cpp MathDll.h
clang -dynamiclib MathDll.cpp -o math.dylib
clean:
rm math.dylib
And running file math.dylib gives
math.dylib: Mach-O 64-bit dynamically linked shared library x86_64
I have a simple program, test1.cpp, that will call one of the functions from this library. I tried to compile it with
clang -I../MathDll -L../MathDll -lmath test1.cpp
but this gives me
ld: library not found for -lmath
clang: error: linker command failed with exit code 1 (use -v to see invocation)
When I invoke Clang with -v, the output is
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.9.0 -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name test1.cpp -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 224.1 -v -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.0 -I ../MathDll -stdlib=libc++ -fdeprecated-macro -fdebug-compilation-dir "/Users/bdesham/Projects/New GUI/math_library/osx_test" -ferror-limit 19 -fmessage-length 118 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.9.0 -fobjc-dispatch-method=mixed -fobjc-default-synthesize-properties -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o /var/folders/gc/4w1rdgzx3zz2dbxf0m_yd67c0000gn/T/test1-sL5rwc.o -x c++ test1.cpp
clang -cc1 version 5.0 based upon LLVM 3.3svn default target x86_64-apple-darwin13.0.0
ignoring nonexistent directory "/usr/include/c++/v1"
#include "..." search starts here:
#include <...> search starts here:
../MathDll
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1
/usr/local/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.0/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.9.0 -o a.out -L../MathDll -lmath /var/folders/gc/4w1rdgzx3zz2dbxf0m_yd67c0000gn/T/test1-sL5rwc.o -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.0/lib/darwin/libclang_rt.osx.a
ld: library not found for -lmath
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I must be doing something silly here. What do I need to do to make the linker find my library?
Your library needs to be called libmath.dylib, not just math.dylib.
I have a problem compiling a program with "-std=c++11 -stdlib=libc++" under mac os x 10.8.3 using clang++ from xcode 4.6.2.
When I try to use std::mem_fn() or (deprecated) std::mem_fun_ref(), I get linker error "symbol(s) not found". The same code (with std::mem_fun_ref instead of std::mem_fn) compiles and links without any issues under the c++03 standard.
If I call the same member function on an object without referring to it via mem_fn or mem_fun_ref, the program compiles and runs without any problems. Is it a clang++ problem, a mac os problem, or am I doing something wrong?
The code:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main(int argc, char **arvc)
{
/* The beginning of the function compiles without any errors */
string str = "It's a test)";
if (str.empty())
{
cout << "String is empty!!!" << endl;
}
vector<string> v1;
v1.push_back("str1");
v1.push_back("str2");
v1.push_back("");
v1.push_back("str4");
v1.push_back("");
v1.push_back("str6");
/* The code after this point leads to linker error */
vector<string>::iterator it = remove_if(v1.begin(), v1.end(), mem_fn(&string::empty));
v1.erase(it, v1.end());
for (it = v1.begin(); it < v1.end(); ++it)
{
cout << " '" << *it << "'" << endl;
}
return 0;
}
The compilation log:
$ xcrun clang++ -v -std=c++11 -stdlib=libc++ ../src/test_cxx.cpp
Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin12.3.0
Thread model: posix
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.8.0 -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name test_cxx.cpp -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 136 -v -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/4.2 -isysroot / -fmodule-cache-path /var/folders/nz/0x05d6p14gddzxxn8ymnn74c0000gn/T/clang-module-cache -stdlib=libc++ -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /Volumes/Work/projects/web/sp3/build -ferror-limit 19 -fmessage-length 80 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.8.0 -fobjc-dispatch-method=mixed -fobjc-default-synthesize-properties -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o /var/folders/nz/0x05d6p14gddzxxn8ymnn74c0000gn/T/test_cxx-kAQ3wk.o -x c++ ../src/test_cxx.cpp
clang -cc1 version 4.2 based upon LLVM 3.2svn default target x86_64-apple-darwin12.3.0
ignoring nonexistent directory "/usr/include/c++/v1"
#include "..." search starts here:
#include <...> search starts here:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1
/usr/local/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/4.2/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.8.0 -syslibroot / -o a.out /var/folders/nz/0x05d6p14gddzxxn8ymnn74c0000gn/T/test_cxx-kAQ3wk.o -lc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/4.2/lib/darwin/libclang_rt.osx.a
Undefined symbols for architecture x86_64:
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::empty() const", referenced from:
_main in test_cxx-kAQ3wk.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This is a bug in clang. I can't find a bug report on it though. A bug report would be much appreciated.
The problem is that string::empty is marked "always_inline", but also the string template is marked extern, meaning that it has been instantiated already for you.
For some reason when we have this combination, and you form a member function pointer to the always_inline member, clang refuses to outline it so that it can point to it. It only refuses if the instantiation is marked as extern.
If you disable either the extern, or the always_inline, then the code will work. You can disable the former by including this in "C++ Other Flags":
-D'_LIBCPP_EXTERN_TEMPLATE(...)='
i am getting the following linker error when compiling our Qt project.
We do not use qmake. We use autoconf & automake..
Now porting to Mac brings the follwoing error:
I have tried using Qt-SDK and by compiling Qt by myself... Neither worked :(
Maybe somebody has an idea?
/bin/sh ../../libtool --tag=CXX --mode=link clang++ -g -O2 -Wl,-rpath -
Wl,/space/dev-libs/instantclient_10_2 -Wl,-rpath -Wl,/space/dev-libs/boost_1_53/lib -v -o showtime showtime-application_resources.o showtime-main.o cmdline.o ../../atcaf/atcafgui/libatcafgui.la
libtool: link: clang++ -g -O2 -Wl,-rpath -Wl,/space/dev-libs/instantclient_10_2 -Wl,-rpath -Wl,/space/dev-libs/boost_1_53/lib -v -o showtime showtime-application_resources.o showtime-main.o cmdline.o -Wl,-bind_at_load ../../atcaf/atcafgui/.libs/libatcafgui.a -L/usr/local/Qt-5.0.1/lib /usr/local/Qt-5.0.1/lib/libQt5Widgets.dylib /usr/local/Qt-5.0.1/lib/libQt5Gui.dylib /usr/local/Qt-5.0.1/lib/libQt5Sql.dylib /usr/local/Qt-5.0.1/lib/libQt5Xml.dylib /usr/local/Qt-5.0.1/lib/libQt5XmlPatterns.dylib /usr/local/Qt-5.0.1/lib/libQt5Network.dylib /usr/local/Qt-5.0.1/lib/libQt5Core.dylib -L/space/dev-libs/log4cxx-dfs/lib /space/dev-libs/log4cxx-dfs/lib/liblog4cxx.dylib -L/usr/lib -laprutil-1 -lexpat -liconv -lpq -lsqlite3 -lldap -llber -lapr-1 -lpthread -L/space/dev-libs/boost_1_53/lib -lboost_python -lpython2.6 -L/space/dev-libs/instantclient_10_2 -lclntsh -lz
Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.2
Thread model: posix
"/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.7.4 -o showtime -lcrt1.10.6.o -L/usr/local/Qt-5.0.1/lib -L/space/dev-libs/log4cxx-dfs/lib -L/usr/lib -L/space/dev-libs/boost_1_53/lib -L/space/dev-libs/instantclient_10_2 -rpath /space/dev-libs/instantclient_10_2 -rpath /space/dev-libs/boost_1_53/lib showtime-application_resources.o showtime-main.o cmdline.o -bind_at_load ../../atcaf/atcafgui/.libs/libatcafgui.a /usr/local/Qt-5.0.1/lib/libQt5Widgets.dylib /usr/local/Qt-5.0.1/lib/libQt5Gui.dylib /usr/local/Qt-5.0.1/lib/libQt5Sql.dylib /usr/local/Qt-5.0.1/lib/libQt5Xml.dylib /usr/local/Qt-5.0.1/lib/libQt5XmlPatterns.dylib /usr/local/Qt-5.0.1/lib/libQt5Network.dylib /usr/local/Qt-5.0.1/lib/libQt5Core.dylib /space/dev-libs/log4cxx-dfs/lib/liblog4cxx.dylib -laprutil-1 -lexpat -liconv -lpq -lsqlite3 -lldap -llber -lapr-1 -lpthread -lboost_python -lpython2.6 -lclntsh -lz -lstdc++ -lSystem /usr/bin/../lib/clang/3.1/lib/darwin/libclang_rt.osx.a
Undefined symbols for architecture x86_64:
"QApplication::palette()", referenced from:
_main in showtime-main.o
"QApplication::commitData(QSessionManager&)", referenced from:
vtable for Application in libatcafgui.a(libatcafgui_la-Application.o)
"QApplication::saveState(QSessionManager&)", referenced from:
vtable for Application in libatcafgui.a(libatcafgui_la-Application.o)
"QAbstractItemView::dataChanged(QModelIndex const&, QModelIndex const&)", referenced from:
vtable for LogTableWWU in libatcafgui.a(libatcafgui_la-moc_LogTableWWU.o)
"QWidget::styleChange(QStyle&)", referenced from:
I had a similar problem when porting from Qt 4 to Qt 5. There were missing functions for QApplication::commitData() and QApplication::saveState().
I had derived a class from QApplication, in the header file I changed
#include <QtGui/QApplication>
to
#include <QApplication>
and this solved the problem.
I had the same problem, although mine was related to QWidget functions (e.g. QWidget::styleChange(QStyle&) or QWidget::fontChange(QFont const&)) rather than QApplication.
As suggested by koan, I looked for all the occurrences of
#include <QtGui/
in my project and replaced them with
#include <
which solved the problem. I tested this with both clang and g++ versions (5.0.1 and 5.0.2) and they both seem to work.
Note:
A number of solutions found on the web proposed to add
QT += widgets
to the qmake project (.pro) file, as this might be related to an existing bug. While I don't think that adding this is a problem, it did not solve this specific issue.