openframeworks / openFrameworks

openFrameworks is a community-developed cross platform toolkit for creative coding in C++.
http://openframeworks.cc
Other
9.97k stars 2.55k forks source link

ofLog() padding error #4482

Open K0j0 opened 9 years ago

K0j0 commented 9 years ago

I'm not sure when this changed but it doesn't look like I can call ofLog() like this anymore ofLog() << "Some stuff"; This doesn't compile either ofLog(ofLogLevel::OF_LOG_NOTICE) << "Log me.";

Whenever I do I get an error about ofLog::padding not being defined. It's a static variable and I don't see a way to initialize it before the operator<< without making a ton of changes. Has the old logging functionality been changed or removed?

bilderbuchi commented 9 years ago

I don't think there have been any changes on this recently. This could be a file inclusion problem maybe? ping @arturoc

arturoc commented 9 years ago

this is working for me without problem, have you tried to use it in an empty application? also if it still doesn't work in an empty example try posting the error you are getting

bilderbuchi commented 9 years ago

also, please give your versions of OF/OS/IDE you are using.

K0j0 commented 9 years ago

Ok, this worked in an empty application so I think the error is caused by one of my addons. The error appears intermittently so I'm not 100% sure but that really seems to be the case. Gonna close this.

For the record though OF 0.9.0 Ubuntu 15.10 64 bit Eclipse 4.4.2

Thanks for the quick responses!

K0j0 commented 8 years ago

I've just run into this issue again and I think I've got a better idea of it now. It doesn't happen in an empty or new project but it does appear if you include an addon that calls an ofLog() function. For example, I'm using ofxJSON in my project. When I add the source for it, or add it to addons make, I get this padding error. It seems like the application is trying to use the padding value before ofLog.cpp has been compiled. Has anyone else run into this? It seems like it would be pretty common.

arturoc commented 8 years ago

do you get a compile error or a runtime error? also can you post the full error output? and is it related with:

https://github.com/openframeworks/openFrameworks/issues/5017

K0j0 commented 8 years ago

Here's the output from the last class being compiled to the end:

Compiling ../../../addons/ofxJSON/src/ofxJSONElement.cpp clang++ -c -g3 -Wall -std=c++14 -DGCC_HAS_REGEX -DOF_USING_GTK -DOF_USING_GTK -DOF_USING_MPG123 -I/usr/include/jsoncpp -I/home/kojo/dev/ForgetIt/addons/ofxJSON/libs/jsoncpp/src -DDESKTOP -D_REENTRANT -pthread -I/usr/include/gstreamer-1.0 -I/usr/lib/x86_64-linux-gnu/gstreamer-1.0/include -I/usr/include/AL -I/usr/include/alsa -I/usr/include/GL -I/usr/include/libdrm -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/mirclient -I/usr/include/mircommon -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I../../../libs/fmodex/include -I../../../libs/glfw/include -I../../../libs/glfw/include/GLFW -I../../../libs/kiss/include -I../../../libs/poco/include -I../../../libs/tess2/include -I../../../libs/utf8cpp/include -I../../../libs/utf8cpp/include/utf8 -I../../../libs/openFrameworks -I../../../libs/openFrameworks/types -I../../../libs/openFrameworks/video -I../../../libs/openFrameworks/events -I../../../libs/openFrameworks/app -I../../../libs/openFrameworks/utils -I../../../libs/openFrameworks/math -I../../../libs/openFrameworks/gl -I../../../libs/openFrameworks/sound -I../../../libs/openFrameworks/communication -I../../../libs/openFrameworks/graphics -I../../../libs/openFrameworks/3d -I/home/kojo/dev/sdks/ofx/git-repo/addons/ofxJSON/src -I/home/kojo/dev/sdks/ofx/git-repo/addons/ofxJSON/libs -I/home/kojo/dev/sdks/ofx/git-repo/addons/ofxJSON/libs/jsoncpp -I/home/kojo/dev/sdks/ofx/git-repo/addons/ofxJSON/libs/jsoncpp/src -I/home/kojo/dev/sdks/ofx/git-repo/addons/ofxJSON/libs/jsoncpp/include -I/home/kojo/dev/sdks/ofx/git-repo/addons/ofxJSON/libs/jsoncpp/include/json -I/home/kojo/dev/sdks/ofx/git-repo/addons/ofxJSON/libs/jsoncpp/include -I/home/kojo/dev/sdks/ofx/git-repo/addons/ofxJSON/libs/jsoncpp/include/json -MMD -MP -MF ../../../addons/obj/linux64/Debug/ofxJSON/src/ofxJSONElement.d -MT ../../../addons/obj/linux64/Debug/ofxJSON/src/ofxJSONElement.o -o ../../../addons/obj/linux64/Debug/ofxJSON/src/ofxJSONElement.o -c ../../../addons/ofxJSON/src/ofxJSONElement.cpp Linking bin/f2_debug for linux64 clang++ -o bin/f2_debug obj/linux64/Debug/src/main.o obj/linux64/Debug/src/ofApp.o ../../../addons/obj/linux64/Debug/ofxJSON/src/ofxJSONElement.o ../../../addons/obj/linux64/Debug/ofxJSON/libs/jsoncpp/src/jsoncpp.o ../../../libs/openFrameworksCompiled/lib/linux64/libopenFrameworksDebug.a -Wl,-rpath=./libs:./bin/libs -Wl,--as-needed -Wl,--gc-sections -B/usr/lib/gold-ld -L../../../libs/fmodex/lib/linux64/ -lfmodex ../../../libs/glfw/lib/linux64/libglfw3.a ../../../libs/kiss/lib/linux64/libkiss.a ../../../libs/tess2/lib/linux64/libtess2.a ../../../libs/poco/lib/linux64/libPocoNetSSL.a ../../../libs/poco/lib/linux64/libPocoNet.a ../../../libs/poco/lib/linux64/libPocoCrypto.a ../../../libs/poco/lib/linux64/libPocoUtil.a ../../../libs/poco/lib/linux64/libPocoJSON.a ../../../libs/poco/lib/linux64/libPocoXML.a ../../../libs/poco/lib/linux64/libPocoFoundation.a -L/usr/lib/x86_64-linux-gnu -lz -lgstapp-1.0 -lgstvideo-1.0 -lgstbase-1.0 -lgstreamer-1.0 -ludev -lfontconfig -lfreetype -lsndfile -lopenal -lssl -lcrypto -lpulse-simple -lpulse -lasound -lGLEW -lGLU -lGL -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lmpg123 -lglut -lX11 -lXrandr -lXxf86vm -lXi -lXcursor -ldl -lpthread -lfreeimage -lrtaudio -lboost_filesystem -lboost_system ../../../libs/openFrameworks/utils/ofLog.h:432: error: undefined reference to 'ofLog::padding' ../../../libs/openFrameworks/utils/ofLog.h:432: error: undefined reference to 'ofLog::padding' ../../../libs/openFrameworks/utils/ofLog.h:432: error: undefined reference to 'ofLog::padding' ../../../libs/openFrameworks/utils/ofLog.h:432: error: undefined reference to 'ofLog::padding' clang: error: linker command failed with exit code 1 (use -v to see invocation) ../../../libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:382: recipe for target 'bin/f2_debug' failed make[2]: Leaving directory '/home/kojo/dev/sdks/ofx/git-repo/apps/myApps/f2' make[2]: * [bin/f2_debug] Error 1 make[1]: * [Debug] Error 2 make: *\ [all] Error 2 ../../../libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:142: recipe for target 'Debug' failed make[1]: Leaving directory '/home/kojo/dev/sdks/ofx/git-repo/apps/myApps/f2' ../../../libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:165: recipe for target 'all' failed

16:51:26 Build Finished (took 4m:29s.569ms)

K0j0 commented 8 years ago

Also, I checked out #5017 and tried making that change for myself but got a similar error. I may have implemented it wrong though. Here's the error output for that as well:

Compiling /home/kojo/dev/sdks/ofx/git-repo/apps/myApps/f2/src/ofApp.cpp clang++ -c -g3 -Wall -std=c++14 -DGCC_HAS_REGEX -DOF_USING_GTK -DOF_USING_GTK -DOF_USING_MPG123 -I/usr/include/jsoncpp -I/home/kojo/dev/ForgetIt/addons/ofxJSON/libs/jsoncpp/src -DDESKTOP -D_REENTRANT -pthread -I/usr/include/gstreamer-1.0 -I/usr/lib/x86_64-linux-gnu/gstreamer-1.0/include -I/usr/include/AL -I/usr/include/alsa -I/usr/include/GL -I/usr/include/libdrm -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/mirclient -I/usr/include/mircommon -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I../../../libs/fmodex/include -I../../../libs/glfw/include -I../../../libs/glfw/include/GLFW -I../../../libs/kiss/include -I../../../libs/poco/include -I../../../libs/tess2/include -I../../../libs/utf8cpp/include -I../../../libs/utf8cpp/include/utf8 -I../../../libs/openFrameworks -I../../../libs/openFrameworks/types -I../../../libs/openFrameworks/video -I../../../libs/openFrameworks/events -I../../../libs/openFrameworks/app -I../../../libs/openFrameworks/utils -I../../../libs/openFrameworks/math -I../../../libs/openFrameworks/gl -I../../../libs/openFrameworks/sound -I../../../libs/openFrameworks/communication -I../../../libs/openFrameworks/graphics -I../../../libs/openFrameworks/3d -I/home/kojo/dev/sdks/ofx/git-repo/apps/myApps/f2/src -I/home/kojo/dev/sdks/ofx/git-repo/apps/myApps/f2/addons -I/home/kojo/dev/sdks/ofx/git-repo/apps/myApps/f2/f2.xcodeproj/xcshareddata -I/home/kojo/dev/sdks/ofx/git-repo/apps/myApps/f2/f2.xcodeproj/xcshareddata/xcschemes -I/home/kojo/dev/sdks/ofx/git-repo/addons/ofxJSON/src -I/home/kojo/dev/sdks/ofx/git-repo/addons/ofxJSON/libs -I/home/kojo/dev/sdks/ofx/git-repo/addons/ofxJSON/libs/jsoncpp -I/home/kojo/dev/sdks/ofx/git-repo/addons/ofxJSON/libs/jsoncpp/src -I/home/kojo/dev/sdks/ofx/git-repo/addons/ofxJSON/libs/jsoncpp/include -I/home/kojo/dev/sdks/ofx/git-repo/addons/ofxJSON/libs/jsoncpp/include/json -I/home/kojo/dev/sdks/ofx/git-repo/addons/ofxJSON/libs/jsoncpp/include -I/home/kojo/dev/sdks/ofx/git-repo/addons/ofxJSON/libs/jsoncpp/include/json -MMD -MP -MF obj/linux64/Debug/src/ofApp.d -MT obj/linux64/Debug/src/ofApp.o -o obj/linux64/Debug/src/ofApp.o -c /home/kojo/dev/sdks/ofx/git-repo/apps/myApps/f2/src/ofApp.cpp Linking bin/f2_debug for linux64 clang++ -o bin/f2_debug obj/linux64/Debug/src/main.o obj/linux64/Debug/src/ofApp.o ../../../addons/obj/linux64/Debug/ofxJSON/src/ofxJSONElement.o ../../../addons/obj/linux64/Debug/ofxJSON/libs/jsoncpp/src/jsoncpp.o ../../../libs/openFrameworksCompiled/lib/linux64/libopenFrameworksDebug.a -Wl,-rpath=./libs:./bin/libs -Wl,--as-needed -Wl,--gc-sections -B/usr/lib/gold-ld -L../../../libs/fmodex/lib/linux64/ -lfmodex ../../../libs/glfw/lib/linux64/libglfw3.a ../../../libs/kiss/lib/linux64/libkiss.a ../../../libs/tess2/lib/linux64/libtess2.a ../../../libs/poco/lib/linux64/libPocoNetSSL.a ../../../libs/poco/lib/linux64/libPocoNet.a ../../../libs/poco/lib/linux64/libPocoCrypto.a ../../../libs/poco/lib/linux64/libPocoUtil.a ../../../libs/poco/lib/linux64/libPocoJSON.a ../../../libs/poco/lib/linux64/libPocoXML.a ../../../libs/poco/lib/linux64/libPocoFoundation.a -L/usr/lib/x86_64-linux-gnu -lz -lgstapp-1.0 -lgstvideo-1.0 -lgstbase-1.0 -lgstreamer-1.0 -ludev -lfontconfig -lfreetype -lsndfile -lopenal -lssl -lcrypto -lpulse-simple -lpulse -lasound -lGLEW -lGLU -lGL -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lmpg123 -lglut -lX11 -lXrandr -lXxf86vm -lXi -lXcursor -ldl -lpthread -lfreeimage -lrtaudio -lboost_filesystem -lboost_system ../../../libs/openFrameworks/utils/ofLog.h:432: error: undefined reference to 'ofLog::getPadding()' ../../../libs/openFrameworks/utils/ofLog.h:432: error: undefined reference to 'ofLog::getPadding()' ../../../libs/openFrameworks/utils/ofLog.h:432: error: undefined reference to 'ofLog::getPadding()' ../../../libs/openFrameworks/utils/ofLog.h:432: error: undefined reference to 'ofLog::getPadding()' clang: error: linker command failed with exit code 1 (use -v to see invocation) ../../../libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:382: recipe for target 'bin/f2_debug' failed make[2]: * [bin/f2_debug] Error 1 make[1]: * [Debug] Error 2 make: *\ [all] Error 2 make[2]: Leaving directory '/home/kojo/dev/sdks/ofx/git-repo/apps/myApps/f2' ../../../libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:142: recipe for target 'Debug' failed make[1]: Leaving directory '/home/kojo/dev/sdks/ofx/git-repo/apps/myApps/f2' ../../../libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:165: recipe for target 'all' failed

16:44:36 Build Finished (took 8s.523ms)

bakercp commented 7 years ago

@K0j0 does this continue to be an issue?