FAQ Database Discussion Community

## java compilation error when using reflection with templates

java,templates,reflection,compiler-errors
I have this code: private <D extends Object> void foo(D d) throws IllegalAccessException, InstantiationException { d = d.getClass().newInstance(); // Compilation error: "Incompatible types: Required D, Found: Object" } Why do I get this error? To my understanding, the compiler knows that d is D type (which extends Object)...?...

## App crashing after pushing button, but the action is working

android,button,android-studio,compiler-errors
Maybe someone sees an error, the problem is that when i push btn2 (button 2) and btn3 (button 3) app crashes, but action still works, i.e video is running and PDF opens, while button 1 is working correctly... @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); configureImageButton(); mCamera = getCameraInstance();...

## C++ template class compilation error message: error: expected a qualified name after 'typename'

c++,templates,compiler-errors,llvm,em++
I am trying to compile code from https://github.com/Sami-Vuorela/aatc I am compiling using LLVMs em++ compiler: em++: version 1.3.2 clang: vesion 3.6.0 Here is the console error message: /opt/emsdk_portable/emscripten/master/em++ -Qunused-arguments -U__STRICT_ANSI__ -Wall -fno-strict-aliasing -std=c++11 -DAS_WRITE_OPS=0 -DAS_USE_STLNAMES=1 -DAS_USE_FLOAT=0 -Iinclude/ -Iangelscript/sdk/angelscript/include/ -Iangelscript/sdk/add_on/scriptbuilder/ -Iangelscript/sdk/add_on/contextmgr/ -Iangelscript/sdk/add_on/scripthelper/...

## “Generics add stability to your code by making more of your bugs detectable at compile time.” - Explained in laymen's terms?

debugging,generics,types,compiler-errors
"Generics add stability to your code by making more of your bugs detectable at compile time." I keep reading this everywhere, but I can't seem to find an explanation for why generics help make errors more detectable in compile time rather then run time. Maybe this might be answered somewhere...

## Declaring pointer to a 3 by 3 array and using pointer to print it

c,arrays,pointers,multidimensional-array,compiler-errors
How can i declare a pointer to an array of 3 by 3 and use that pointer to print it.... The compiler is giving the error "[Error] subscripted value is neither array nor pointer nor vector " #include <stdio.h> int main(void) { int A[3][3][3]={0}; int *ptr=A; int i,j,k; for(i=0;i<3;i++) {...

## Why would a program compile for me, but not for another person?

java,compiler-errors,final
My code is below. It compiles fine for me, however my professor is saying he's getting an error because I don't have a few variables in my class declared final. Eclipse doesn't seem to have a problem with this on my machine so I don't know how to fix what...

## Argument Type Problems

casting,compiler-errors,fortran
Why am I getting the following error d = Atan ( 1_Real32 / 110443_Real32 ) 1 Error: 'x' argument of 'atan' intrinsic at (1) must be REAL or COMPLEX The funny thing is that I get no problems when I use d = Atan ( Real(1,Real32) / Real(110443,Real32) ) ...

## “Identifier Expected” error?

c#,unity3d,compiler-errors,unityscript,identifier
using UnityEngine; using System.Collections; public class Sword : MonoBehaviour { var totalhealth = 100; function OnTriggerEnter(other : Collider){ if(other.tag == "angelic_sword_02"){ totalhealth -= 50; } } function Update(){ if(totalhealth <= 0){ Destroy(gameObject); } } } I get an "Identifier Expected" in the script where it says in the line function...

## Why do I need to add const to the argument?

linux,compiler-errors,g++,gtkmm
I have this function : void SpookyBoy( bool Troublemaker, const Glib::ustring& name, HorrorPunkBand& band ); if I remove the word const I got this error : no known conversion for argument 2 from ‘const char [5]’ to ‘Glib::ustring&’ I just wonder what does the compiler, can someone explains to me...

## Variable repeat error?

java,android,compiler-errors
Why am I getting a compile-time error in the following code? private static void phi(int n){ if(n > 1000) for(int i = 3; i <= n; i += 2) //do something else for(int i = 35; i <= n; i += 90) //do something } The error says java:22: error:...

## C++ with Qt compile fail

c++,qt,compiler-errors

## what is the compile error in this code [closed]

c,linux,compiler-errors,fwrite,pid
I'm trying to get this output of this code in linux, but I get the following error: quiz5.c: In function ‘main’: quiz5.c:19:35: error: expected ‘)’ before ‘abcdefghi’ write(p[1], "abcdefghi', sizeof("abcdefghi")); ^ quiz5.c:19:44: warning: missing terminating " character [enabled by default] write(p[1], "abcdefghi', sizeof("abcdefghi")); ^ quiz5.c:19:35: error: missing terminating " character...

## Multiple definition and file management

c,arrays,compilation,compiler-errors,include
I'm writing a program for vocabulary training, for myself. And the program itself should be available in different languages, atm in German and English. What I want is to have a Main File which manage all and two separate files for the functions in the right language. I compile all...

## Compile error when trying to print an integer in Rust v0.13.0

compiler-errors,rust
I thought this would work: let x = 5; println!("x = {}", x); But it gives the following compile error: main.rs:3:24: 3:25 error: unable to infer enough type information to locate the impl of the trait core::fmt::Show fo r the type _; type annotations required main.rs:3 println!("x = {}", x);...

## tcc: error: undefined symbol '[email protected]'

c++,c,compiler-errors
I'm making a program in C/C++ which must run hidden using this code: #define _WIN32_WINNT 0x0500 #include <windows.h> int main(){ HWND hWnd = GetConsoleWindow(); ShowWindow(hWnd, SW_HIDE); . . . } I really want to use tinyc to compile it because it's much better than gcc (almost, the final executable is...

## Typescript internal modules - unable to reference exported class within same module

javascript,compilation,compiler-errors,typescript,tsc
Hi! First off, sorry if this has been asked before, I tried some Googling but wasn't able to find anything (at least nothing that I recognised as being the same problem). I'm new to Typescript so still getting to grips! I'm making a little game as a project to brush...

I am trying to implement a method that returns a generic list (List), but I keep getting this error message: The type or namespace name 'T' could not be found (are you missing a using directive or an assembly reference?) This is my method code: public static List<T> doQuery(string query)...

## Compile error “No global operator found” for templated overloaded operator

c++,templates,compiler-errors
I've defined a template class and overloaded operators. When compiling, I get the following error message: error C2677: binary '+=' : no global operator found which takes type 'Class' (or there is no acceptable conversion) Here is the relevant code of the class: template<int foo> class Class { private: int...

## Error when overwriting value in unsigned char array [closed]

c++,arrays,compiler-errors
Why do I get the error message error: invalid conversion from ‘const char*’ to ‘unsigned char’ [-fpermissive] if I try to overwrite a certain value in an array of data type unsigned char? The data type I want to overwrite the value is also a unsigend char....

## C: Error in Using: “Compound Assignment” and “Prefix Decrement” together

c++,c,compiler-errors,compound-assignment,prefix-operator
Can someone please tell me why the C compiler outputs an error while using a Compound Assignment and a Prefix Dec/Inc together ? [ but C++ does not ] int myVar = 5; (--myVar) -= 4; // C : error C2106: '-=' : left operand must be l-value // C++:...

## Error: expected constructor, destructor, or type conversion before '=' toke

c++,compiler-errors,arduino
Not too sure why I am getting an error here. Working with an Arduino, and it's compiler. If anyone can help clear this up for me that would be greatly appreciated. unsigned char topState, leftState, rightState, fwdState, bwdState; topState = leftState = rightState = fwdState = bwdState = 1; Error:...

## malloc doesn't allocate 3d array properly

c,arrays,pointers,compiler-errors,malloc
I am writing a program in c that would read the ppm input file and convert it to ASCII art. In the program, I alllocated a 3d array that would store the height and width of the input file and the RGB components. The array elements (pixels) would then be...

## Call to implicitly-deleted copy constructor in LLVM(Porting code from windows to mac)

c++,osx,c++11,compiler-errors,llvm
We are in the process of porting some c++ code from windows to mac and are having issues compiling it with LLVM 6.1 using c++11. We are encountering errors all over the place of "Call to implicitly-deleted copy contructor" Some of these errors are popping up in our code. for...

## Dereferencing pointer to incomplete type error for struct member access in Python swig C wrapper

python,c,gcc,compiler-errors,swig
What is the error while compiling swig Python wrapper under GCC 4.8.2? wfdb_python_wrap.c:3967:11: error: dereferencing pointer to incomplete type if (arg1->fname) free((char*)arg1->fname); ^ wfdb_python_wrap.c:3967:36: error: dereferencing pointer to incomplete type if (arg1->fname) free((char*)arg1->fname); source code from wfdb_python_wrap.c: ... #include <wfdb/wfdb.h> ... #ifdef __cplusplus extern "C" { #endif SWIGINTERN PyObject *_wrap_WFDB_Siginfo_fname_set(PyObject...

## Undefined reference to pico_dhcp_server_initiate when compiling PicoTCP for ARM mbed

c++,c,compiler-errors,makefile,embedded
I'm working on a project where I have to work with PicoTCP (see https://developer.mbed.org/users/daniele/code/PicoTCP/, I'm using an older version of this library). In my main.cpp file, I have the following code: #include "pico_stack.h" #include "pico_dhcp_server.h" int main(void) { // create DHCP server struct pico_dhcpd_settings s = { }; s.my_ip.addr =...

## Unable to Access Anonymous Class Method in Java

java,compiler-errors,anonymous-class,anonymous-inner-class
I receive a compiler error whenever I attempt to invoke a method belonging to an anonymous class from the outer class. Example: public class Test { public static void main(String[] args) { Test testObj = new Test(){ public void doStuff(){ System.out.println("Test"); } }; testObj.doStuff(); } } The error the compiler...

## why is this code giving me “expected unqualified-id” error [closed]

c++,compiler-errors
here is the ideone link: https://ideone.com/0fqnCG #include <iostream> #include <string> using namespace std; int main() { string cases[8] = {"TTT", "TTH", "THT", "THH", "HTT", "HTH", "HHT", "HHH"}; int p, j, i; cin >> p; int sets[p]; string toss[p]; string new; for (i = 0; i < p; i++) { cin...

## How to compile MapReduce job source code on Hadoop 2.7.0?

I running Hadoop 2.7.0 on ubuntu 14.0.2 O.S., and I create wordcount.java with nano text editor which the source code is copy from Apache Hadoop 2.7.0 Document. After I compile wordcount.java with this command javac -classpath hadoop-2.7.0-core.jar -d MyJava wordcount.java, here are the error messages I got. public class WordCount2...

## bad operand types for binary operator compiling error

java,arrays,multidimensional-array,compiler-errors,operators
for a game i'm making I need to place a tetris-like piece on a 10x10 game board. I want to return "offboard" if the player tries to put the piece on a cell that is outside the board For this, I've made an initial method that returns true if the...

## TreeMap Compile Error

java,compiler-errors
This is my code: import java.util.*; public class TreeMap { public static void main(String[] args) { Map<String,Integer> treemap = new TreeMap<String,Integer>(); Some code to fill the treemap ie treemap.put("Kevin", 36); } } And I am getting this compiler error: TreeMap.java:5: error: type TreeMap does not take parameters Map<String,Integer> treemap =...

## Array in for-loop is not working for some reason

c++,arrays,for-loop,compiler-errors
I don't see why this won't compile when the syntax is correct: int arrows[1] = {23}; for(arrows[1]; arrows[1] < 300; arrows[1]++) { cout << arrows[1]; } Errors: error: expected unqualified-id before 'for' !! error: 'arrows' does not name a type !! error: 'arrows' does not name a type I am...

## Implicit declaration of function and conflicting type - AVR

c++,c,compiler-errors,avr,atmega16
This is my first program for AVR. While building, the code is showing error: conflicting types for 'Encode' implicit declaration of 'Encode' I have written the following code: #include <avr/io.h> #include <util/delay.h> #include <stdlib.h> #define SegDataPort PORTC #define SegDataPin PINC #define SegDataDDR DDRC #define SegCntrlPort PORTD #define SegCntrlPin PIND #define...

## Haskell: ==' is not a (visible) method of class

So, when I compile the following piece of code edited: instance (Eq a) => PartOrd a where [] == [] = True (x:xs) == (y:ys) = x==y && xs==ys _==_ = False xs /= ys = not (xs == ys) I get: `==' is not a (visible) method of class...

## Can someone help me fix this error in Swift "Apple Mach-O Linker Error?

ios,xcode,swift,compiler-errors
"Linker command failed with exit code 1(use -v to invocation)". I don't understand what that means and not sure where to go to fix it. I looked at solutions in stackoverflow but none of them are working for me. I cleaned the project also but still not getting rid...

## How do you fix c++ expected primary expression error?

c++,compiler-errors
So, i'm new to c++ programming, and as a assignment my teacher is having us create an app. I started coding it and this is what i came up with. I tried to compile the code in CodeBlocks and it gave me quite a few errors: error: expected primary-expression before...

## Can't reference a variable from App.config

c#,compiler-errors,app-config
I'm trying to reference a variable from App.config in my C# file. Here's a sample of my code. App.config: <appSettings> <add key="ErrorEmails" value="[email protected]"/> </appSettings> Code: SettingsIO setIO = new SettingsIO(); public static string To = setIO.ReadSetting("ErrorEmails"); The error reads: A field initializer cannot reference the non-static field, method, or preperty...

## Glibc Compilation Error

linux,compilation,compiler-errors,make,glibc
I'm compiling glibc-2.12.1 in Ubuntu 10.10 (32 bit in VirtualBox). Steps followed: configure --prefix=/usr --disable-asm make [I'm building it from a new directory] I'm getting the following errors on running make: gcc ../sysdeps/i386/fpu/s_frexp.S -c -D__NO_MATH_INLINES -D__LIBC_INTERNAL_MATH_INLINES -I../include -I/home/l33thckr/Installations/glibc-build/math -I/home/l33thckr/Installations/glibc-build -I../sysdeps/i386/elf -I../nptl/sysdeps/unix/sysv/linux/i386/i686 -I../sysdeps/unix/sysv/linux/i386/i686...

## Getting 'Missing Lifetime specifier' error

This is my code: use std::ptr; struct Query<T>{ data: T, prev: & Query<T>, next: & Query<T>, } impl<T> Query<T>{ fn new(name: T) -> Query<T>{ Query{ data: name, prev: ptr::null(), next: ptr::null(), } } } I keep getting 'missing lifetime specifier' where I am referencing &Query<T>. How do I fix this...

## Why this code got “unreachable statement” error?

java,compiler-errors,unreachable-code
I have the following method : char getChar(int I) { if (I<65+26) return (char)(I); switch (I) { case 91 : return '?';break; case 92 : return '#';break; default : return ' '; } } Why does it get "unreachable statement" error ?...

## Deserialize JSON with Jackson into Polymorphic Types - A Complete Example is giving me a compile error

java,json,compiler-errors,polymorphism,jackson
I am attempting to work through a tutorial from Programmer Bruce that is supposed to allow the deserialization of polymorphic JSON. The complete list can be found here Programmer Bruce tutorials (Great stuff btw) I have worked through the first five with no problems but I have hit a snag...

## How to abort or stop JavaScript execution?

javascript,jquery,error-handling,compiler-errors
I am working in one example and that at some point(when something specific happen) to stop the execution of javascript code. Here is the row where I detect the error(rows number 36 at the DEMO): if(error_print === null){ s += "errors+='"+"You have error in row :" + (i+1) + "';";...

## Swift - String substringWithRange - 'String' is not convertible to '()'

string,swift,compiler-errors
I am trying some simple code, which I found on natashatherobot.com. var str = "Hello, playground" let rangeOfHello = Range(start: str.startIndex, end: advance(str.startIndex, 5)) let helloStr = str.substringWithRange(rangeOfHello) return helloStr It works fine when I try it in Playgrounds: But when I try using it in my Xcode project it...

## Unhandled Exception when calling SipProfile.Builder from Android SIP Class

java,android,object,android-studio,compiler-errors
There is an error when creating a Builder object. This is my code: SipProfile.Builder builder = new SipProfile.Builder("address","username"); The error:: unhandled exception: java.text.ParseException This is a sample from Android Reference.: public SipProfile mSipProfile = null; ... SipProfile.Builder builder = new SipProfile.Builder(username, domain); builder.setPassword(password); mSipProfile = builder.build(); http://developer.android.com/guide/topics/connectivity/sip.html#manager...

## C# - How to handle empty user input?

c#,compiler-errors
Hello everyone i'm still a beginner in programming in general. So my question is how to handle empty user input in my simple code?, it give's me error every time i press enter with out a value. My code: //Program to find the number is even or odd. using System;...

## split an equation with multicols on

compiler-errors,latex,equation,multicol
I would like to split my large equation in two column. But my file fails to compile when I try to use \{amsmath} and then split, multline, etc... The error says: Package amsmath Error: \begin{multline} allowed only in paragraph mode. \begin{multline} Does someone knows how to split a large equation...

## Compile-time method call validation for multiple parameters of the same type

c#,methods,compiler-errors
Here is demonstration of the problem: class Program { static double Func(double a, double b) { return a * 1000 + b * b; } static void Main(string[] args) { var a = 1.1d; var b = 2.2d; Console.WriteLine(Func(a, b)); // this is the problem, function doesn't recognize when a...

## Class Array usage generates the error “NullReferenceException: Object reference not set to an instance of an object”

c#,arrays,class,compiler-errors
I am currently working on a server system for a game called Reign of Kings. I am using hooks and commands given by the Oxide developers to make my server system. Back in the PAWN Language, we could do something like enumeration of player data inside an array, which converts...

## Compiling issue with ifort composer_xe_2015.3.187

compiler-errors,fortran
I am compiling my Fortran code with the latest Fortran compiler composer_xe_2015.3.187 on Ubuntu 14.04 64 bit system. I am using this compiler flag: -fp-model precise The error message is: f95: error: precise: No such file or directory f95: error: unrecognized command line option ‘-fp-model’ The same code does not...

## Trying programming with C, Getting Expected x before Y type error

c,if-statement,compiler-errors
Trying my hand at C (Self teaching and using The New Boston guides) but trying to make a simple ask these questions and then if the answer matches then print X or Y. I have commented out yourAge as for what I'm doing i dont need it, It works if...

## MultipartEntityBuilder.create cannot be resolved to a type

java,eclipse,compiler-errors
I try to create a multipartEntityBuilder in oder to send an httpRequest. The code i found was using MultipartEntity, so i changed that to MultipartEntityBuilder. MultipartEntityBuilder reqEntity = new MultipartEntityBuilder.create(); This gives me an error MultipartEntityBuilder.create cannot be resolved to a type I have added the httpmime-4.5.jar file in my...

## C# - Not being able to use list.Count() in this scenario

c#,list,count,compiler-errors,protection
I've been getting this error during compile: System.Collections.Generic.List<string>.Count is inaccessible due to its protection level about trying to use the method Count() on a list I created that represents an inventory in my project. The list itself is public so I can't get my head around as to why this...

## Build Failure on Android Studio

After updating all the Google support libraries to the latest versions, from v21 to v22.2.0 and Play Services to v7.5, my project no longer builds successfully. The log i get is as follows: app:preDexDebug AGPBI: {"kind":"simple","text":"Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar ","sources":[{}]} AGPBI: {"kind":"simple","text":"Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar ","sources":[{}]} AGPBI: {"kind":"simple","text":"Picked up JAVA_TOOL_OPTIONS:...

## Double templated function overload fails

c++,visual-studio-2010,templates,compiler-errors,c++03
I have a template class, having various template functions. One of them need to be overloaded (a couple of times). Basically - if my class would not be a template, these would be my function(s): class OtherClass { public: template<class T> T foo(T &t, const std::string &trash); }; template<class T>...

## os kern error : “ld: symbol(s) not found for architecture x86_64”

c++,architecture,compiler-errors,x86-64,clang++
I have looked all over Stack Overflow and other websites about this famous error, and all of them are very specific, and in my case I cannot find a solution. I am making an ncurses application and when i try to compile it, it causes the following error: Undefined symbols...

## C++ - stoi() was not declared in this scope

c++,c++11,gcc,compiler-errors,codeblocks
I'm practicing my C++ by coding simple input/ouput from user. I have now been searching for over an hour on how to convert a string to an int. Every answer is different, and require something else. I'm using Code::Blocks v.13.12. MingW32 folder is added to environment variables. I ended up...

## LINQ to Entities does not recognize the method 'System.String ToString(Int32)'

c#,.net,linq,entity-framework,compiler-errors
Hi I am using a linq query which is throwing the error LINQ to Entities does not recognize the method 'System.String ToString(Int32)' method, and this method cannot be translated into a store expression. List<string> resultMap = (from item in mapResult select Convert.ToString(item.ResultDE)).ToList(); Error is throwing in this below statement List<Result_DE>...

## Why array indexing not showing commutative behavior in this program?

c++,arrays,templates,compiler-errors
I know that array indexing is commutative in both C & C++, so a[i] is same as i[a] and it would have same effect as i[a] and both are valid. But recently I wrote a following program that fails to compile when I use i[intob] instead of intob[i]. #include <iostream>...

## Generics error syntax Java 1.7 on generics function

java,generics,compiler-errors,syntax-error
Using Java 1.7 compiler, it is interesting to note that the syntax accepted to call generic functions is very particular. It forces you to use this to refer to the generic function. For example for a function defined as: private <T> Object genericFunction(T t){ //function code } When referring to...

css3,compiler-errors,compass
Just added Compass filters to my code base. // This file is main.scss @import "breakpoint"; @import "compass/css3"; @import "compass/css3/user-interface"; @import "compass/css3/transform"; // Just added filters. @import "compass/css3/filters"; @import "compass/utilities/general/clearfix"; @import "base/base"; @import "views/views"; Now the Compass compile task is failing and giving the following error: error wp-content/themes/example/styles/main.scss (Line 5: File...

## error: 'wxGraphicsContext' was not declared in this scope

c++,compiler-errors,wxwidgets
#include <wx/graphics.h> file included, wxWidgets 3.0.2 on Windows 7 compiled with USE_GDIPLUS=1 flag. and still I get this error error: 'wxGraphicsContext' was not declared in this scope What might be causing this? Thanks....

## output with lseek and open functions, keep getting compile or running time error

c,compiler-errors,fwrite,truncate,lseek
I'm trying to running this code in my eclipse but I keep getting errors, so if anyone can tell me how to change this code so I get the output that would be great! anyways I have some basic questions on this code, I hope you can help What does...

## The type 'System.Runtime.InteropServices.SafeHandle' exists in both 'System.Runtime.InteropServices.dll' and 'System.Runtime.Handles.dll'

c#,dll,reference,compiler-errors,interop
I'm currently porting a Windows 8.1 app to a Windows 10 UAP app which uses interop to communicate between C++ and C# and I'm having the following error popping up : \$(ProjectName).Interop.g.cs : error CS0433: The type 'System.Runtime.InteropServices.SafeHandle' exists in both 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETCore\v4.5.1\System.Runtime.InteropServices.dll' and 'c:\Program Files (x86)\MSBuild\Microsoft.NetNative\x86\ilc\lib\McgDependencies\System.Runtime.Handles.dll' From...

## Could not find member in Swift (multiple instances)

ios,swift,compiler-errors
I am trying to build my Xcode project however, I keep getting "Could not find member " build errors in three different instances from the code below. Please help. Instances: Could not find member 'dataSource' self.pageViewController.dataSource = self 2&3. Could not find member 'Forward' self.pageViewController.setViewControllers(viewControllers, direction: .Forward, animated: true, completion:...

## unrecognized debugging option: 1 [enabled by default]

c,gcc,compiler-errors,makefile,cross-platform
I am writing a cross-platform gtk application for Windows and linux in C. Today I came across the strange compiler error in the title (which I have never seen before). This happens when I build my program in Windows, but not in Linux. When I build it in Windows via...

## Using ocamlbuild to build SDL and OpenGL application

opengl,compiler-errors,ocaml,sdl,ocamlbuild
I am trying to create an OCaml program utilizing both ocamlsdl and lablgl, but I can not figure out how to compile it. The relevant information is below: Note: ocamlsdl is not found by ocamlfind. When I go to the lib directory of .opam, I find an ocamlsdl folder, but...

## Will Roslyn be part of the .NET framework?

c#,.net,github,compiler-errors,roslyn
Will Roslyn be part of the .NET framework? Which version and when? It is actually available at GitHub but it is fairly big and I'm not able to load it in Visual Studio 2013 on Windows 7 without errors....