FAQ Database Discussion Community

## 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...

## 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...

## Dereferencing pointer to incomplete type error for a structure member

c,arrays,struct,compiler-errors,dynamic-memory-allocation
I have checked the other questions with similar problems, but none of the solutions worked for my case. The problem in hand is, I am trying to create a stack with dynamic memory, using this struct: struct stekas{ int content; struct stekas *link; } *top = NULL; However, I'm running...

## 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...

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

c#,dll,reference,compiler-errors,interop

## Android findViewById(), getComponentName() and getSystemService(): Cannot make a static reference to a nonstatic field from type Activity

java,android,android-activity,compiler-errors
In the following class, I am getting the following three compiler errors in the enableAssistedSearch method. Cannot make a static reference to the non-static method getSystemService(String) from the type Activity Cannot make a static reference to the non-static method getComponentName() from the type Activity Cannot make a static reference to...

## iOS inline if else compile error: “Expected : ”; “Expected expression”

ios,objective-c,if-statement,compiler-errors
I am learning iOS programming (I come from Android) and I am looking for get Strings more easy. With this propose I define the next macro and use it in some code fragment: #define STRING_BASE @"InfoPlist" #define getString(string) NSLocalizedStringFromTable(string, STRING_BASE, @""); ... BOOL isSomething = YES; //or NO _label.text =...

## How to throw an error in the LESS compiler

css,compiler-errors,less,throw,less-mixins
Question Is there any way to (programmatically) throw an error in the LESS compiler? Why? I have been fiddling around with mixin guards today, because I wanted to generate my CSS margin based upon element size and element count. I thought it would be cool to directly throw an error...

## 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...

## 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...

## 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....

## 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...

## Why does gcc search header files from non-exist folders?

c,linux,gcc,compiler-errors,make
I am trying to build an open source project shark on CentOS 7, and get very weird build errors: make: *** No rule to make target /usr/lib/gcc/x86_64-linux-gnu/4.8/include/stdarg.h', needed by core/luv/luv.o'. make: *** No rule to make target /usr/lib/gcc/x86_64-linux-gnu/4.8/include/stddef.h', needed by core/luv/luv.o'. make: *** No rule to make target /usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed/limits.h', needed...

## 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...

## cannot find symbol method get(int)

java,compiler-errors
For a game i'm making I need to place a tetris-like piece on a 10x10 game board. I want to return "occupied" if the player tries to put the piece on an occupied square on my board. For this, I've made an initial method that returns true if the square...

## 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)...?...

## 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...

## 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...

## C++ with Qt compile fail

c++,qt,compiler-errors
I'm trying to compile the following short C++ program (not written by me) in Debian: \$ cat checksig.cpp #include <QByteArray> #include <QDebug> #include <openssl/ec.h> #include <openssl/evp.h> #include <openssl/ecdsa.h> #include <openssl/sha.h> static EC_KEY* EC_KEY_pub_key ( const QByteArray& pub ) { static EC_KEY* eckey = EC_KEY_new_by_curve_name ( NID_secp256k1 ); const quint8* ppub...

## 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>...

## 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...

## 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...

## 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'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...

## 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) + "';";...

## ActionListener of JComboBox and initialize JPanel

java,swing,compiler-errors,actionlistener,jcombobox
I want to write program in which you can chance scene (JPanel) thanks to JComboBox. I used ActionListener, but it doesn't work. At the beginning of constructor I defined panel as final, but it didn't help. scene.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String choice = String.valueOf(scene.getSelectedItem()); if(choice=="Sceneria"||choice=="Scene"){ slider.setEnabled(false);...

## 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...

## Multi-case parameterized active patterns returning error FS0722 Only active patterns returning exactly one result may accept arguments

compiler-errors,f#,active-pattern
Since I only found Japanese pages about this error, I figured, let's log it and ask here, since my Japanese is kinda rusty. If I have the following FSharp active pattern (simplified example): let (|InRange|OutOfRange|) from too = function | input when input >= from && input <= too ->...

## 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 =...

## 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...