w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Calculations with long double in clang – Compiler bug?
This is expected behavior. long double a = 1.L + DBL_MAX + 1.L; The long double type is floating point: it has a finite amount of precision. The result of most operations is rounded to the nearest representable value. See What Every Programmer Should Know About Floating-Point Arithmetic.

Categories : C

Installing Clang/LLVM/Ubuntu
When you typed: clang -03 -emit-llvm hello.c -c -o hello.bc You used the system's clang executable, which is at /usr/bin/clang, and is not the clang you have just built. The two have a different version. lli, however, is the lli you've just built - Ubuntu doesn't come with it. That means you have generated a .bc file with an older LLVM version and then tried to run it with a newer LLVM version, hence the problem. To verify this, you can check which clang you are using by typing which clang into the console. The simplest way to remedy this is to type ./clang (or any other path which isn't just the file name) instead of clang, which forces the shell to choose the file in the current directory.

Categories : Linux

How to install clang pre-built binaries ubuntu 12.04
Instead of manually install it you can use the LLVM repo, add it to your apt sources and install it via apt-get or the Ubuntu packet manager. See LLVM apt repo on how to do it. Do the steps as written in the Install paragraph, in a terminal: sudo wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add - sudo apt-get install clang-3.4 lldb-3.4

Categories : Ubuntu

Which C99-compiler (Clang vs. GCC) is closer to standard on const structure fields?
const variable can't be modified after initialization, otherwise it's undefined behavior. Since it is undefined behavior, I think one can say both gcc and clang follow the standard. (Although gcc's choice seems better, it deserves a warning) (See EDIT below) The only way to give the variable x a value with defined behavior is to initialize it: SX sx = { .x = 10 }; EDIT: As @Keith Thompson comments below, it's more than just undefined behavior in this case: C99 §6.5.16 Assignment operators Constraints An assignment operator shall have a modifiable lvalue as its left operand. This is a constraint, and according to: C99 §5.1.1.3 Diagnostics A conforming implementation shall produce at least one diagnostic message (identified in an implementation-defined mann

Categories : C

List of all Objective-C preprocessor directives in Clang
Most of them have not been introduced in LLVM/Clang, but were inherited from GCC. Therefore, searching for gcc preprocessor directives may lead to better results. The following document could give you some hints, but it does not seem to be complete (missing some of the above mentioned pragmas) nor is it specific to Objective-C: http://gcc.gnu.org/onlinedocs/cpp/index.html#Top This index may be faster to browse: http://gcc.gnu.org/onlinedocs/cpp/Index-of-Directives.html#Index-of-Directives

Categories : IOS

what is (LLVM Clang) ? is it software to code in objective c?
Forget the term "LLVM". You can indeed install the Clang compiler and use it to compile Objective-C. Example, on Ubuntu: > sudo apt-get install clang > clang myfile.m Clang is a C, C++ and Objective-C compiler. It's a part of the LLVM collection of projects, and uses other parts extensively, which explains why you also heard the term "LLVM". As an end-user, though, you shouldn't care - just install and use it. I'm also guessing you will be interested in this answer on how to get some basic library to work with.

Categories : Ubuntu

how to change gcc compiler to c++11 on ubuntu
gcc 4.6.3 supports many c++11 features. However, they are disabled by default. To enable them, use the following flag: g++ -std=c++0x ... This flag also disables GNU extensions; to keep them enabled, use -std=gnu++0x flag.

Categories : C++

Is the GNU compiler that comes with Ubuntu 12.04 not compliant with C++ 11?
GCC versions prior to 4.7 use "-std=c++0x" instead of "-std=c++11" since the standard wasn't definitely C++11 at the time those versions were released. There are C++11 features present in later GCC versions that will not be implemented on older versions. GCC 4.8.1 is the first release that is truly C++11 feature-complete. I imagine you can update the compiler packages to something recent while keeping the majority of your Ubuntu install at 12.04.

Categories : C++

Linking to Clang and LLVM on Unix - forced to use LLVM's compiler flags?
See http://llvm.org/docs/Packaging.html: LLVM disables RTTI by default. Add REQUIRES_RTTI=1 to your environment while running make to re-enable it. This will allow users to build with RTTI enabled and still inherit from LLVM classes.

Categories : C++

Unable to compile Objective-C code on Ubuntu
+(id)new is a function of the NSObject class. However, you are subclassing a runtime object. To use most of the Apple methods you're used to using in OS X, you'll need to subclass NSObject instead. Also, you declare an object's superclass in the interface, not the implementation. You need to change @implementation CDB : NSObject to @implementation CDB, then, in your header file, place @interface CDB : NSObject { ...

Categories : Objective C

Compilation Errors in running objective c code in ubuntu 12.10
If gcc couldn't find Object.h, it would give an error indicating that. The problem is that Apple removed most of the methods from Object.h (or at least the interface for it) in Objective-C 2.0. The main reason your program is giving these errors is that gcc is not including the Object class. Instead, you should subclass NSObject and include the Foundation framework.

Categories : Objective C

Why doesn't C# compiler optimize away duplicate local variable default value initialization?
Why doesn't compiler omit generating IL for things like int foo = 0; for local variables since .locals init already cover that? Why should it? I have not actually verified this, but I would be surprised if the JIT compiler generated different native code if you removed the unnecessary initialization. What this means is that the only benefit adding this optimization to the C# compiler would have is to make the JIT compilation tiny bit faster (because it would have to process smaller amount of IL code). It seems the authors of the C# compiler though that making this optimization for such a tiny benefit is not worth it.

Categories : C#

How to install clang checker-275 and give me some example to configure Clang Scan-Build Plugin?
Please check this. I am also facing the same issue the i came to know that not only I but also many people facing the same issue. http://www.mail-archive.com/llvmbugs@cs.uiuc.edu/msg23874.html

Categories : Misc

(Objective-)C++ Duplicate symbol on template specialization
Your error is twofold. First of all you write template code in a .cpp file. Then, to correct that error, you include the .cpp file in a header, another bad idea. Why? A class template is not really a class, yet, just a template for a group of classes. The classes that can be made from it are created as needed. A .cpp file, on the other hand, is only compiled once, which is not enough and not even meaningful, since you only have a template at this point. On the other hand, to include a .cpp file is a bad thing in itself, since it typically results in recompilation of code that may not be recompiled, hence the link errors. EDIT: Either you can define the specializations in a .cpp file (but no pure template code, and don't include it!), or you can inline them and keep them in the header:

Categories : C++

Constants in Objective-C and "duplicate symbol" linker error
If you want to use constant only in one .m file then declare it as static. For example:static NSString * const CONSTANT_STRING = @"Constant I am". In case of NSInteger you can write in your every .m file: static const NSInteger my_const = 3; If you want globals (one constant with one value visible in every file) then write in your .h: extern const NSInteger my_global_const; and in your .m file you can add const NSInteger my_global_const = 5;

Categories : IOS

How can i open terminal through a php command in ubuntu?
It looks like you want to run binary file through php .... if it is Try this... Also make sure the binary file has 0777 permission <?php //Command $cmd = './svdpp --training=/home/zubair/graphchi_v0.2.6/graphchi/smallnetflix_mm.train.txt --validation=/home/zubair/graphchi_v0.2.6/graphchi/smallnetflix_mm.validate.txt --binary_relevance_thresh=4 --sgd_gamma=1e-6 --max_iter=30 --quiet=1 --sgd_step_dec=0.9999 --sgd_lambda=1e-6 --D=3 --minival=1 --maxval=10'; //Binary Directory Path $cwd = '/toolkits/collaborative_filtering/'; $descriptorspec = array ( 0 => array ( "pipe", "r" ), 1 => array ( "pipe", "w" ), 2 => array ( "pipe", "r"

Categories : PHP

How to reference/open a window in Objective-c
The short answer is: In AppDelegate.h, declare a "window" property: @property (strong) IBOutlet NSWindow* window; In MainMenu.nib, connect your main window to the "window" property of "AppDelegate": Right-click on the "AppDelegate" object, then click on the widget next to the "window" property and drag it to your window. Your "AppDelegate" instance will now have a "window" property, and it will be assigned to your main window.

Categories : Objective C

ASP.NET MVC 3 Strongly-typed Views: Why do compiler errors disappear/are ignored when a view is not open in VS editor?
You can compile cshtml and aspx files at build time instead of runtime. To do this unload project, open it for edit, find <MvcBuildViews> tag and change value to true. If you have edmx files in your project clean solution before first edit.

Categories : Asp Net

How to feed Visual Studio Clang-Format plugin with clang-format file?
Go to Tools->Options->LLVM/Clang->ClangFormat and put file in the Style option field. Then place you style file named .clang-format (this is the full filename, not an extension) either in the source file's directory or one of its parent directories. Windows Explorer won't let you create filenames with leading . so you need to go to the console for this.

Categories : C++

open file in command line tool app xcode objective c
Command-line tools don't have a bundle associated with them. You'll have to store the file somewhere else (a directory in /Library/Application Support, for example, or perhaps somewhere in /usr/local/share if you're installing the tool to /usr/local) and read it from there.

Categories : Xcode

Are there languages which compile to Objective-C or are binary compatible with Objective-C -> Coffeescript for Objective-C
While the primary way to use eero is to have it compile to native code, it does support source-to-source translation as well (from eero to standard Objective-C/C++). Please see https://github.com/eerolanguage/eero/wiki/Translator for more details. It really needs to be documented in a more obvious place...

Categories : IOS

Trouble in Setting Java Environment Path on Ubuntu (libjvm.so: cannot open shared object file: No such file or directory)
Put "-Djava.library.path=FULL_PATH_HERE/jre/lib/amd64" as a JVM option in your C code. Edit the full_path_here part. The path is allowed to be relative, but I don't think you can use $JAVA_HOME as a placeholder for the environment variable.

Categories : Java

i am facing problems while running a code on GNU GCC compiler while it's working fine on VC++ compiler
You are not allocating enough memory: mat=(char**)malloc(row*sizeof(char)); label=(char**)malloc(row*sizeof(char)); Each item in the arrays is a pointer to char (char*), so you should multiply by sizeof(char*): mat=(char**)malloc(row*sizeof(char*)); label=(char**)malloc(row*sizeof(char*));

Categories : C

C++ compiler error: passing pointers but compiler sees references
In your second signature, the type of the second formal parameter, var, is const double**. The actual argument, constr, is, hovewer of type double** which cannot be implicitly converted to the former type. Example #include <stdio.h> void fn(const int** pp) { printf("%p : %p : %d", pp, *pp, **pp); } int main() { int n = 1; int *p = &n; fn(&p); // ERROR. see below return 0; } The error reported is accurate: main.c:17:8: Passing 'int **' to parameter of type 'const int **' discards qualifiers in nested pointer types.

Categories : C++

Switched to Code Blocks from c++ with updated gcc compiler which causes errors in my source code that compiled fine with the old gcc compiler v3
Do it this way SendMessage(hwnd_SSMAIN_PARENTCONTAINER_RTFCONTROL,WM_SETTEXT,(WPARAM)0, (LPARAM)webfilebuffer.str().c_str()); This code converts a char* to an LPARAM, which should be legal. You will have to change the code that receives the message too. Post that code if you need help with that.

Categories : C++

fatal error C1001: INTERNAL COMPILER ERROR (compiler file 'msc1.cpp', line 1794)
I figured out what caused that error. One of the include paths (passed to a compiler with the /I switch) had a trailing backslash. The compiler cmdline is: CPP /nologo /MT /W3 /GX /Zi /Od /I "$(ZLIB_PATH)" /I "..headers" and ZLIB_PATH had a trailing backshlash. Removing that backslash solved the problem.

Categories : C++

Default Values C++11, compiler to compiler
In all versions of C++, all the variables in your question will be zero-initialized (statically) if they're declared at namespace scope. In all other cases, they will have garbage values if left uninitialized. Note that a garbage value is anything which is at the memory location where the variable is defined — it is just a pattern of 0s and 1s. Such values shouldn't be read by your program, else your code will invoke undefined behaviour. In C++11, if you write these as local variables (or namespace variables): bool foolean {}; int fintoo {}; double fooble {}; char charafoo {}; They're default-initialized which means zero in this case (as they are built-types).

Categories : C++

Problems calling objective c @dynamic properties from objective c runtime
You can call the setter and getter methods indirectly by using the NSObject methods - [NSObject setValue:(id) forKey:(NSString *)]; - (id)[NSObject valueForKey:(NSString *)]; where the key is the property name, if the property is a primative type like unsigned long, double etc. Then the setValue and value methods will deal with NSNumber equivalents. Also you can call the property setter and getter the same way you call other methods, so you can use all of the dynamic method invocation features you can use with regular methods, thought you probable have already worked that out.

Categories : Objective C

Binding objective-c library to Xamarin Project using Objective Sharpie
If Objective-Sharpie doesn't work for your project, you can: Do a manual binding, or build upon David Sandor's one. That's not that hard. Try to find the offending part of the header file, by removing part of it and process it with Obj-Sharpie (the header file is not that long, once you strip the comments away)

Categories : Objective C

Unable to invoke function defined in Objective-C++ from Objective C
You're unable to make the call from C to C++ (and the same principal applies when it's Objective) due to name mangling, something C++ does to your symbols to enable overloading. If you declare extern "C" int add(int, int); for example, you declare that this C++ function needs to be callable by C and so no name mangling can occur (and no overloading can occur either). Note that the C/ObjC side of things doesn't like the extern "C" notation, so your header files need to account for that (perhaps through an #ifdef __cplusplus).

Categories : C++

Ubuntu: How to upgrade ubuntu 11 to ubuntu 13?
Ubuntu 11.04 is apparently not "supported" anymore... it was not a LTS (Long Term Support) release (http://www.omgubuntu.co.uk/2012/10/ubuntu-11-04-support-ends-today) There seems to be an option of "updating" things on "old-releases" (but they are not actively maintained/updated anymore), by editing your source repositories location: http://askubuntu.com/questions/101479/are-existing-updates-available-after-end-of-support. However, if you want to update to a 2013 version, probably the best you can do is to backup your data and configurations and install a new version from scratch. Pay attention to the fact that non-LTS versions stop being supported after around 2 years.

Categories : Ubuntu

How to combine two multidimensional arrays with showing duplicate keys or if duplicate, must add the values
$array1 = array( 'a1' => array(200,300,300), 'a2' => array(100,600,200)); $array2 = array( 'a1' => array('gen','gen2','gen'), 'a2' => array('gen2','gen3','gen3')); $result = array('a1' => array(), 'a2' => array()); foreach($array2 as $k => $v) { foreach ($v as $k2 => $v2){ if (array_key_exists($v2, $result[$k])){ $result[$k][$v2] += $array1[$k][$k2]; } else { $result[$k][$v2] = $array1[$k][$k2]; } } } Output: Array ( [a1] => Array ( [gen] => 500 [gen2] => 300 ) [a2] => Array ( [gen2] => 100 [gen3] => 800 ) )

Categories : PHP

Objective C setters, help understanding the basics of objective c
I'll tackle your first question... When you use synthesize a property, you are merely auto-creating the setter and getter for an instance variable. Say you have: @property (nonatomic, strong) NSString *title; The synthesize: @synthesize title; Creates the following methods: - (NSString) title; - (void) setTitle:(NSString *)value; Now within your class, you want to access the title property, you would do so by using either title or self.title. Even though these both appear to be the same thing, they are not. title accesses the instance variable itself, while self.title is accessing the "synthesized" method - (NSString) title; Wouldn't it make things simpler if we had some sort of way to more easily distinguish between the two? Well that is exactly where @synthesize title = _title;

Categories : IOS

Hudson server running app engine, duplicate shell script executions result in duplicate property errors
It might be the case that the dev_appserver is already running and then you run it again with hudson job. The best way will be to stop the dev_appserver instance first and then pump it up again.

Categories : Python

What platform (server installed on ubuntu vs ubuntu server) to prefer for website development?
There seems to be a lot of confusion in your post. Based on your lack of experience with GNU/Linux, I would suggest you use desktop Ubuntu. The difference between Ubuntu server and Ubuntu desktop is that the server edition is targetted to experienced users, so you get a very minimal distribution. No GUI, nothing preinstalled except the bare minimum. As for your comment about Apache/Glassfish, the two aren't comparable. Apache is the name of the open source community which looks after a lot of products. Very often people call Apache's httpd just "apache", which is a web server. Glassfish is a Java EE application server (Oracle's reference implementation) so probably a good place to start with Java EE.

Categories : Apache

Ubuntu/Python- How to call ubuntu commands and 3rd party applications through Python
Take a look at os.path for directory navigation. To execute a shell command use os.system. The example you posted could go something along the lines of: os.chdir(os.path.expanduser('~/Documents/XDF_Thumbnails_Sci')) for file in os.listdir('.'): if os.path.splitext(file)[1] == ".feedme": os.system("~/galfit %s" % file)

Categories : Python

Same android cmake git project compiles well on one Ubuntu machine but does not compile on another Ubuntu machine even the entire project is the same
whoa! Solved! It was really a weird behaviour from cmake: I had three files conf.c that must be merged into a static library. When cmake run the AR program to create the library, it executed a command that was like: ar cr dir1/source1.c dir1/source2.c ... dft/conf.c rdft/conf.c ar r reodft/conf.c dir2/source3.c so, maybe due to the huge number of object files that were to be linked, cmake splitted ar commands in two command, BUT second command overwrited one of the two file conf.c that were added with the first command, so symbols defined with the first ar command were lost! This is clearly a bug in ar because even if the source file is the same, maybe the content may vary, thus symbols are not to be deleted. Thanks to all! Your suggestions brought me to the right solution!

Categories : Android

Difference between ubuntu and ARM Ubuntu
ARM Ubuntu according http://www.ubuntu.com/download/arm is for ARM-based systems only. It supports Calxeda ECX-1000 and Marvell Armadaxp (12.04 LTS only) production boards. Ubuntu update will not happen automatically. It checks if there is new updates automatically but never will update without yours permission. Security updates can be enabled to be updated automatically. For this you need to install unattended-upgrades: sudo apt-get install unattended-upgrades sudo dpkg-reconfigure unattended-upgrades If you want to have home server - install Ubuntu Server 12.04 LTS. It's reliable and the most important free. It will do all your detailed operations like file sharing and more.

Categories : Ubuntu

Clang 3.3 and C++14 support?
Post-C++11 language features in Clang 3.3 are enabled with this command-line switch: -std=c++1y Check out the bottom of this page http://clang.llvm.org/cxx_status.html for the list of currently supported post-C++11 features in Clang 3.3. Also, here you will find discussions on the upcoming C++14 and usage examples: http://www.meetingcpp.com/index.php/br/items/a-look-at-cpp14-papers-part-1.html

Categories : C++

OS X clang -pthread
clang requires -pthread when compiling but not when linking. This is annoying, but it is observed behavior: $ clang -c x.cpp $ clang -pthread -c x.cpp $ clang -o x x.o $ clang -pthread -o x x.o clang: warning: argument unused during compilation: '-pthread' $ $ clang --version Apple LLVM version 5.0 (clang-500.2.76) (based on LLVM 3.3svn) Target: x86_64-apple-darwin13.0.0 Thread model: posix $

Categories : C++



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.