compiler-errors

dereferencing pointer to incomplete type

I've seen a lot of questions on this but I'm going to ask the question differently without specific code. Is there a way of EASILY determining what is causing the type to be incomplete? In my case I'm using someone elses code and I'm completely sure I don't have the headers right, but (since computers do this stuff much faster and bett...

Auto-(un)boxing fail for compound assignment

Thanks to the implicit casting in compound assignments and increment/decrement operators, the following compiles: byte b = 0; ++b; b++; --b; b--; b += b -= b *= b /= b %= b; b <<= b >>= b >>>= b; b |= b &= b ^= b; And thanks to auto-boxing and auto-unboxing, the following also compiles: Integer ii = 0; ++ii; ii++; --ii; ii--; ii += i...

Delphi: All constants are constant, but some are more constant than others?

Consider: const clHotlight: TColor = $00FF9933; clLink = clHotLight; //alias of clHotlight [Error] file.pas: Constant expression expected and the alternate wording that works: const clHotlight = TColor($00FF9933); clLink = clHotLight; //alias of clHotlight Explain. Then consider: const AdministratorGUID: TGUI...

Getting 'error while loading shared libraries' when using -L to specifically find the library.

I've been trying to solve this for a few hours now. I am compiling some c files using gcc. The files require libpbc, so I am using the -L flag to point gcc at the directory which contains libpbc.so.1. The code compiles without error yet when I attempt to run it I get the following error message: ./example.out: error while loading sh...

fatal error C1016: #if[n]def expected an identifier

// File: Lab13Frac.h #include <iostream> using namespace std; #ifndef "Lab13Frac.h" #define "Lab13Frac.h" // prototpes #endif ...

"Invalid assignment" error from == operator

I was trying to write a simple method: boolean validate(MyObject o) { // propertyA && propertyB are not primitive types. return o.getPropertyA() == null && o.getPropertyB() == null; } And got a strange error on the == null part: Syntax error on token ==. Invalid assignment operator. Maybe my Java is rusty after a season in...

C++ Class Static variable problem - C programmer new to C++

Hi guys, I am a C programmer, but had learnt C++ @school longtime back. Now I am trying to write code in C++ but getting compiler error. Please check and tell me whats wrong with my code. typedef class _filter_session { private: static int session_count; /* Number of sessions count -- Static */ public: _filter_session(); ...

#import still gets "duplicate symbol" error

When I compile my iPhone app, xCode gives "duplicate symbol" error for my variables in MyConstants.h I thought if I used: #import "MyConstants.h" it would avoid that? But I still have the problem. Added info: The error occurs during "linking". (I'm just using xCode's "Build and Go" button.) I also tried the (unnecessary with #im...

Use C function in C++ program; "multiply-defined" error

I am trying to use this code for the Porter stemming algorithm in a C++ program I've already written. I followed the instructions near the end of the file for using the code as a separate module. I created a file, stem.c, that ends after the definition and has extern int stem(char * p, int i, int j) ... It worked fine in Xcode but it ...

MinGW and "declaration does not declare anything"

I'm working on converting a Linux project of mine to compile on Windows using MinGW. It compiles and runs just fine on Linux, but when I attempt to compile it with MinGW it bombs out with the following error message: camera.h:11: error: declaration does not declare anything camera.h:12: error: declaration does not declare anything I'm...

Can't get Javac to work on Mac OS X

I am trying to compile with javac on Snow Leopard through the command line. I have Xcode installed. I am just using a simple Hello World file, it works in Eclipse but I can't get it to work using javac. javac -version returns javac 1.6.0_17 HelloWorld.java public class HelloWorld { public static void main(String[] args) { Strin...

Problem creating an array of objects C++

I have a class and I want to create an array of a number instances, specifically a matrix class: class Matrix { public: Matrix(int sizeX, int sizeY); Matrix(); ~Matrix(); ....//omiting the rest here private: int dx, dy; float **p void allocArrays() { assert(dx>0); assert(dy>0); p =...

Friendness and derived class

Hi, Let's say I have the following class hierarchy: class Base { protected: virtual void foo() = 0; friend class Other; }; class Derived : public Base { protected: void foo() { /* Some implementation */ }; }; class Other { public: void bar() { Derived* a = new Derived(); a->foo(); // Compile...

Invalid function declaration. DevC++

Why do I get invalid function declaration when I compile the code in DevC++ in Windows, but when I compile it in CodeBlocks on Linux it works fine. #include <iostream> #include <vector> using namespace std; //structure to hold item information struct item{ string name; double price; }; //define sandwich, chips, and drink str...

A/UX cc compiler errors on trivial code: "declared argument argc is missing"

On a quite ancient UNIX (Apple A/UX 3.0.1 for 680x0 processors) using the built-in c compiler (cc), this issue arrises. Here is the code I'm trying to compile: #include <stdlib.h> #include <stdio.h> int main() int argc; char **argv; { if (argc > 1) puts(argv[1]); return (EXIT_SUCCESS); } And here is the o...

TypeError: Cannot find function 1.0.

Hi, I have a script and I'm almost done but I get this error and frankly I have no idea what is wrong here. I'm rather new to Javascript so I suspect I did something wrong in the syntax somewhere. Here is an extract from the script containing the offending line : var gc = 0; var seg; var segCount = 0; var groupCount = 0; var groupLev...

Factory Method and Cyclic Dependancy

Edit: Thanks folks, now I see my mistake. If I'm not wrong, because of its nature in factory method there is cyclic dependency: Base class needs to know subclasses because it creates them, and subclasses need to know base class. Having cyclic dependency is bad programming practice, is not it? Practically I implemented a factory, I hav...

Singleton with inheritance, Derived class is not able to get instantiated in parent?

Below code instantiates a derived singleton object based on environment variable. The compiler errors saying error C2512: 'Dotted' : no appropriate default constructor. I don't understand what the compiler is complaining about. EDIT: Fixed issues with implementing the get instance method which requires definition of both the parent and ...

Why is undefined behavior allowed (as opposed to not compiling/crashing)?

I understand the reasons for compiler/interpreter language extensions but why is behaviour that has no valid definition allowed to fail silently/do weird things rather then throwing a compiler error? Is it because of the extra difficulty(impossible or simply time consuming) for the compiler to catch them)? P.S. what languages have undef...

Explicitly typing variables causes compiler to think an instance of a builtin type doesn't have a property, which it does

I narrowed the causes of an AS3 compiler error 1119 down to code that looks similar to this: var test_inst:Number = 2.953; trace(test_inst); trace(test_inst.constructor); I get the error "1119: Access of possibly undefined property constructor through a reference with static type Number." Now if I omit the variable's type, I don't ge...