I'm using clang 3.6 (nightly built) in windows with Code Blocks. Everything works great but the following warning is bothering me:
warning: 'auto' type specifier is incompatible with C++98 [-Wc++98-compat]
I can see that the command line is:
clang++.exe -Weverything -fexceptions -g -std=c++14 -I...
Where do the first two settings come from? I have checked the global and project compiler setting but nowhere do I set -Weverything.
You can try editing your .cbp file (the code::blocks project file) with an editor and try finding the -Weverything switch there.
Look for something like this...
<Compiler>
<Add option="-Wall" />
<Add option="-fexceptions" />
</Compiler>
I'm using gcc but you should find something similar for clang
Related
This is what my files look like
My main function is here
I compiled it using the following command:
g++ -std=c++17 main.cpp linkedList.cpp -o main
on MacOS 10.14 using the latest gcc compiler as of 2018.
It looks like the definitions for your template are not visible to the compiler when it is instantiated. You need to move the definitions from linkedList.cpp into the header file, linkedList.hpp.
(Note that C++17 support is still experimental in GCC.)
I'm trying to profile a Swift application in Instruments and am having difficulty because debug symbols for libswiftCore.dylib and libswiftFoundation.dylib libraries are not being displayed. The mouseover text suggests using File -> Symbols to manually select the dSYM files but I have no idea where they are stored, or even if they exist. Symbols from code that I've written are appearing fine.
I set up a test project and profiled it in instruments to demonstrate:
How can I identify the functions shown from libswiftCore.dylib?
This answer is copied from https://github.com/Flash3001/iOSCharts.Xamarin/issues/17
by: Flash3001
but hope this will help you:
The file is located in: /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS
Before:
<Target Name="_CalculateCodesignAppBundleInputs" Condition="'$(_RequireCodeSigning)' == 'true'">
<ItemGroup>
<_CodesignAppBundleInput Include="$(_NativeExecutable)" />
<_CodesignAppBundleInput Include="$(_AppBundlePath)Info.plist" />
<_CodesignAppBundleInput Include="$(_AppBundlePath)embedded.mobileprovision" />
<_CodesignAppBundleInput Include="$(DeviceSpecificIntermediateOutputPath)Entitlements.xcent" />
<_CodesignAppBundleInput Include="#(_BundleResourceWithLogicalName)" />
<_CodesignAppBundleInput Include="#(_NativeLibrary)" />
<_CodesignAppBundleInput Include="#(_Frameworks)" />
<_CodesignAppBundleInput Include="#(_ResolvedAppExtensionReferences -> '$(_AppBundlePath)PlugIns\%(FileName)%(Extension)\_CodeSignature\CodeResources')" Condition="'$(IsAppExtension)' == 'false'" />
<!-- Include WatchOS1 App references -->
<_CodesignAppBundleInput Include="#(_ResolvedWatchAppReferences -> '$(_AppBundlePath)%(FileName)%(Extension)\_CodeSignature\CodeResources')" Condition="'$(IsAppExtension)' == 'true'" />
<!-- Include WatchOS2 App references -->
<_CodesignAppBundleInput Include="#(_ResolvedWatchAppReferences -> '$(_AppBundlePath)Watch\%(FileName)%(Extension)\_CodeSignature\CodeResources')" Condition="'$(OutputType)' == 'Exe'" />
</ItemGroup>
</Target>
<Target Name="_CodesignAppBundle" Condition="'$(_RequireCodeSigning)' == 'true'" DependsOnTargets="$(_CodesignAppBundleDependsOn)"
Inputs="#(_CodesignAppBundleInput)"
Outputs="$(DeviceSpecificIntermediateOutputPath)codesign\$(_AppBundleName)$(AppBundleExtension)">
After:
<Target Name="_CalculateCodesignAppBundleInputs" Condition="'$(_RequireCodeSigning)' == 'true'">
<ItemGroup>
<_CodesignAppBundleInputs Include="$(_AppBundlePath)**\*.*" Exclude="$(_AppBundlePath)_CodeSignature\CodeResources" />
</ItemGroup>
</Target>
<Target Name="_CodesignAppBundle" Condition="'$(_RequireCodeSigning)' == 'true'" DependsOnTargets="$(_CodesignAppBundleDependsOn)"
Inputs="#(_CodesignAppBundleInputs)" Outputs="$(_AppBundlePath)_CodeSignature\CodeResources">
Warning: Do not copy the entire file, as it will break other things.
Warning 2: You should not normally modify this file, as it is Xamarin's and can stop the build process from working if you do the wrong thing.
Warning 3: It will be replaced when you update Xamarin.
If you have installed Xcode in the default location, the swift dylib files can be found in:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/
(Please note, these are not dSYM files)
Under this directory you will find a subdirectory for the different build targets, for example, macosx for OS X, iphoneos for iOS devices and iphonesimulator for the simulator etc. (browse to the lib folder to view what's there)
Loading the correct file from one of these folders should hopefully work.
If all else fails you may need to build your own copy of the swift libraries with debug symbols form the source code which can be found at https://github.com/apple/swift
You can find the dSym files in your archives
under xcode-> Window -> Organizer -> Archives
choose the proper version of your build -> Show in finder -> Show Package Contents => you'll find a "dSYMs" folder there.
You could load them into the Instruments application.
As I am assuming you want the meanings of commands
Compilation command looks something like:
swift -frontend -gnone -O -Xfrontend -disable-red-zone -Xcc -mno-red-zone -Xcc -mno-mmx -Xcc -mno-sse -Xcc -mno-sse2 -parse-as-library -import-objc-header -whole-module-optimization -module-name MyModule -emit-object -o
-gnone disables debug information which probably isn't very useful until you have some sort of debugger support
-O is for optimisation, the other options being -Onone which turns it off but produces a larger amount of code and -Ounchecked which is -O but without extra checks after certain operations. -O produces good code but does tend to inline everything into one big function which can make it hard to workout what went wrong when an exception handler simply gives the instruction pointer as the source of an error.
-Xfrontend -disable-red-zone ensures that code generated from the swiftc doesn't generate red zone code.
-Xcc -mno-red-zone tells the clang compiler not to use the red zone on any files it compiles. clang is used if there is any code in the header file you use which will probably be the case as will be shown.
-Xcc -mno-mmx -Xcc -mno-sse -Xcc -mno-sse2 uses clang options to tell swiftc not to use MMX/SSE/SSE2
-parse-as-library means that the code is not a script.
-import-objc-header allows a .h header file to be imported that allows access to C function and type definitions.
-module-name is required although is only used in fully qualifying the method and function names. However actual module files are not created with this option.
Libraries
Now that a .o ELF file has been produced it needs to be linked to a final executable. Swift requires that its stdlib is linked in as this provides some basic functions that are needed by Swift at runtime.
The library name is libswiftCore.a and should be in lib/swift_static/linux under the install directory.
libswiftCore.a relies on libc, libcpp and a few other system libraries however they wont be available so the missing functions need to be emulated. The full list of symbols that need to be implemented can be found here :- https://github.com/spevans/swift-project1/blob/master/doc/symbols.txt
I am working on a project that was previously done and uploaded on app store.When I run this app in Xcode 5.0 it is working fine but when I run this on Xcode Version 5.1.1 (5B1008) I am getting Linker error on both device and simulator.
Error Message- Library not found for -llib. (clang: error: linker command failed with exit code 1 (use -v to see invocation)).
I have searched a lot but I didn't get any thread about Library not found for -llib error. Is there anything I have to change in build settings to resolve this?
Look at the linker command line in detail for the -L options being used:
Then use Terminal or Finder to see if your libXXX.a file exists in those directories. If the library exists elsewhere then you need to configure your Library Search Paths:
However there several details which you have not provided in your question when using a library within an app:
Is the library built as part of the Xcode project/workspace (as in the first image)?
Is the library supplied by a third-party with binary (.a) and header files (as in the second image)?
TL;DR: I ran make in the wrong directory so the paths were messed up.
Problem:
>make
linking ../build/release/yubikey-personalization-gui
/usr/x86_64-suse-linux/bin/ld: cannot find -llib
...
I ran into this when compiling the Yubikey Personalisation Tool. I tracked down the -llib call in my Makefile which looked like this:
...
LINK = #echo linking $# && g++
...
LIBS = $(SUBLIBS) -L/usr/lib64 -L../lib/release -llib -lyubikey -lykpers-1 -lQtGui -L/usr/lib64 -L/usr/X11R6/lib -lQtCore -lpthread
...
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
So it was setting a variable called LINK which would print "linking" and then call g++, which is the compiler.
Then it set the var LIBS which would hold the ominous -llib.
Then it composes and runs the command $(LINK) ... $(LIBS).
Which runs g++ with the parameter -llib.
And what does that do? Turns out -l<something> is telling the compiler to use the something-library. So it asks for the library called lib here. Which is strangely generic. I figured out that the sources came with a directory called lib/, which was at ../lib.
So starting make from a directory higher up fixed it.
You should remove libstdc++ from other linker flags in your xcode project
https://stackoverflow.com/a/53103383/1344237
I've been trying to compile Qt for iOS, but I've been having some crazy problems that noone else seems to be having (at least according to what I read in the past day).
I followed the instructions from this article:article url
I cloned a the latest Qt 4.8 from git: $ git clone git://gitorious.org/qt/qt.git
I made the qt-lighthouse-ios-simulator folder, cd to it.
I ran the long line of code from the article: $ ../qt/configure -qpa -xplatform qpa/macx-iphonesimulator-g++ -arch i386 -developer-build -release -opengl es2 -no-accessibility -no-qt3support -no-multimedia -no-phonon-backend -no-svg -no-webkit -no-scripttools -no-openssl -no-sql-mysql -no-sql-odbc -no-cups -no-iconv -no-dbus -static -nomake tools -nomake demos -nomake docs -nomake examples -nomake translations
opensource license
yes I accept the agreement
I get these errors:
In file included from /System/Library/Frameworks/ApplicationServices.framework/Frameworks/HIServices.framework/Headers/Accessibility.h:13,
from /System/Library/Frameworks/ApplicationServices.framework/Frameworks/HIServices.framework/Headers/HIServices.h:49,
from /System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:34,
from generators/mac/pbuilder_pbx.cpp:56:
/System/Library/Frameworks/ApplicationServices.framework/Frameworks/HIServices.framework/Headers/AXUIElement.h:65: error: CGCharCode has not been declared
/System/Library/Frameworks/ApplicationServices.framework/Frameworks/HIServices.framework/Headers/AXUIElement.h:65: error: CGKeyCode has not been declared
After struggling with this, searching here and there, and finding nothing useful (even nothing about what CGKeyCode or CGCharCode actually are, I decided to "hack" it and just added the definitions to pbuilder_pbx.cpp:
typedef u_int16_t CGCharCode; /* Character represented by event, if any */
typedef u_int16_t CGKeyCode; /* Virtual keycode for event */
Then another file couldn't compile, with the same errors. After adding them to a couple of files, I eventually added them to qcore_mac_p.h, then some files complained that they didn't know what u_int16_t was, so I added
typedef unsigned short u_int16_t; /* compile, god damn you!!! */
to the same header.
Now everything compiled but there was this linker error:
ld: in /System/Library/Frameworks//CoreGraphics.framework/CoreGraphics, missing required architecture x86_64 in file for architecture x86_64
Here's where I'm stuck. Any help?
Additional information:
gcc --version : i686-apple-darwin10-g++-4.2.1
iOS SDK: I have both 4.2 and 4.3
OS X version: 10.6.7
Xcode version (if it matters): 4.0.2
The problem somehow magically doesn't exist, when I tried the same thing on a different Mac with OS X 10.7.1
I have no idea how and why, but now qmake compiles and links.
I have been coding in python before and included the library of openCV without any problem. Now, I want to code in C++ so I downloaded eclipse and openCV libraries and included their path in the includes from eclipse ..
I have simple example of openCV and I am trying to run it, but I get this error -->
**** Build of configuration Debug for project Example ****
make all
Building file: ../Test.cpp
Invoking: GCC C++ Compiler
g++ -I/usr/local/include/opencv -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"Test.d" -MT"Test.d" -o "Test.o" "../Test.cpp"
Finished building: ../Test.cpp
Building target: Example
Invoking: GCC C++ Linker
g++ -o "Example" ./Test.o
/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../crt1.o: In function _start':
(.text+0x20): undefined reference tomain'
./Test.o: In function gh::main()':
/home/shamma/workspace/Example/Debug/../Test.cpp:16: undefined reference tocvCreateImage'
/home/shamma/workspace/Example/Debug/../Test.cpp:21: undefined reference to cvNamedWindow'
/home/shamma/workspace/Example/Debug/../Test.cpp:22: undefined reference tocvShowImage'
/home/shamma/workspace/Example/Debug/../Test.cpp:23: undefined reference to cvWaitKey'
/home/shamma/workspace/Example/Debug/../Test.cpp:24: undefined reference tocvDestroyWindow'
/home/shamma/workspace/Example/Debug/../Test.cpp:25: undefined reference to `cvReleaseImage'
collect2: ld returned 1 exit status
make: * [Example] Error 1enter code here
any idea what might be the cause of the problem, I have tried lots of things without use
thanks in advance
It seems you have not properly configured OpenCV libraries. I recommend you to follow the OpenCV tutorial to start using it with Eclipse.
In eclipse go to project->properties->settings and under GCC C++ linker-> libraries and assuming you're just testing, add "opencv_core" and "opencv_highgui" there are many more and for each library you need to manually include them so that eclipse can tell the compiler to link these libraries when you run your program.
Also as a note generally "cvE______" is opencv for C where as for C++ it would be cv::E____ , its really confusing that sometime you can get away with both, but not always, so stick the the function in the namespace without cv prefixes.