compiler-errors

Printing the address of a struct object

I have a struct like this typedef struct _somestruct { int a; int b; }SOMESTRUCT,*LPSOMESTRUCT; I am creating an object for the struct and trying to print it's address like this int main() { LPSOMESTRUCT val = (LPSOMESTRUCT)malloc(sizeof(SOMESTRUCT)); printf("0%x\n", val); return 0; } ..and I get this warning ...

Compile error: 'The type or namespace name 'Runtime' does not exist in the namespace 'MyAppNamespace.System' (are you missing an assembly reference?)'

I am writing a WPF client that consumes services from an ASP web service (VS2010, .net 4.0). It was working just fine until yesterday when I suddenly get the above compiler error. Double-clicking on the error takes me to Reference.cs and highlights just about anything along the lines of: [System.Runtime.Serialization.DataMemberAttribute...

C++: Unknown pointer size when forward declaring (error C2036)

In a header file, I have forward declared two members of a namespace: namespace Foo { struct Odp typedef std::vector<Odp> ODPVEC; }; class Bar { public: Foo::ODPVEC baz; // C2036 }; The error generated by the compiler is: error C2036: 'Foo::Odp *': unknown size I'm guessing this is an issue with forward declaring Odp....

C++: Trouble with tr1::bind (C2065)

I'm getting a compiler error with bind: using namespace std; bool odp(int arg1, int arg2); // ... find_if(vec.begin(), vec.end(), tr1::bind(odp, iValue, _1)); // C2065 My goal is to curry odp(), so its first argument is iValue, and apply that function in find_if. The error: C2065: '_1' : undeclared identifier. What am I doing w...

IBM RAD With Java 1.5 wont compile code with generics

Hello I have some code that has generic references in it and my IBM RAD IDE will not compile the code, instead treating it as an error. I have checked the version of the JRE its pointing to across all the Enterprise Project's and it is 1.5 which I am told does support generics. Also I checked that all the libraries for WAS were pointi...

error in c, but not in c++

const int t=5; char buf[t+5]; When I compile this gives error in C but not in C++!! Can anybody please explain me the reason? Note: I know the const defaults to internal linkage in 'C++', where as in 'C' it defaults to external linkage. Does it has any relation to the above case?? ...

C++ compiler error on template specialization

I would like to specialize a template method for a class C that is itself templated by an int parameter. How do I do this? template <int D=1> class C { static std::string foo () { stringstream ss; ss << D << endl; return ss.str();} }; template <class X> void test() { cout << "This is a test" << endl;} template <> template <...

Getting compiler error while using array constants in the constructor.

public class Sonnet29 implements Poem { private String[] poem; public Sonnet29() { poem = { "foo", "bar" , "baz"}; } @Override public void recite() { //... } } Line poem = { "foo", "bar" , "baz"}; is giving compilation error. Any specific reason why this is not allowed? How do I initialize a Stri...

Problem using templated predicate in STL algorithms

I have the following piece of code, that gives an error on the first usage form of pred2. I was hoping if someone could explain why this particular usage is incorrect, as I think pred3 usage is similar. #include <algorithm> bool pred1(const int&) { return true; } template<typename T> bool pred2(const T&) { return true; } struct pred3...

Calling a Lua script from C: errors

I'm new at Lua and writing bindings in general. At the moment I'm just trying to compile the first example found here (with the functions updated to Lua 5.1). #include <stdio.h> #include "lua.h" #include "lualib.h" #include "lauxlib.h" /* the Lua interpreter */ lua_State* L; int main ( int argc, char *argv[] ) { /* initialize Lua...

StdAfx + Header file - Order of inclusion in MFC application

I am using Visual Studio 2005. I created an MFC based console application named "StdAfx dependancy". The IDE created the following files for me. Resource.h StdAfx Dependancy.h stdafx.h StdAfx Dependancy.cpp stdafx.cpp I added another class CHelper with Helper.h and Helper.cpp as below. Helper.h: #pragma once class CHelper { public...

LINK : fatal error LNK1104: cannot open file '..\json_spirit\Debug\json_spirit_lib.lib'

Can someone point me in the right direction? I'm not a C++ or VS developer but I'm trying to compile a project and I'm getting the above error. I don't have any clue why the compiler is looking for that file or what the Debug folder is about (though I could guess). Can somebody explain the issue in other words for me and give me some ...

C++ class redefinition error help

Hi All, I am getting errors like: FxMathFunctions.h: In function 'FxInt32 IMin(FxInt32, FxInt32)': FxMathFunctions.h:13: error: redefinition of 'FxInt32 IMin(FxInt32, FxInt32)' FxMathFunctions.h:15: error: 'FxInt32 IMin(FxInt32, FxInt32)' previously defined here In FxMathFunctions.h I have: 11: struct FxPoint2d; 12: 13: inline Fx...

Telerik Extensions for ASP.NET MVC Q1 2010: Not compiling: Shows warning :The referenced component 'System.Web.MVC' could not be found.

If I try to compile the source of Telerik Extensions for ASP.NET MVC Q1 2010 it is not getting compiled. It shows error: The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) Tried to remove and add the System.Web.MVC but still it dont recognize it as valid ref...

Flash ActionScript Files Suddenly Not Compiling?!

i have built a custom class, which i call from a frame script. the custom class takes only one parameter, which is a string URL of an XML file. SUDDENLY, when i move all the files off of my desktop into a different folder, i receive compiler errors, stating it can not find my custom class .as file, even though it's in the same folder! ...

Compiler error coming out of yaml-cpp

I'm attempting to integrate yaml-cpp into a project, but I'm seeing some unexpected errors out of GCC. For example: g++ -c -ggdb3 -ansi -Wall -Werror -pedantic-errors src/commands-tz.cpp -o obj/commands-tz.o In file included from /usr/local/include/yaml-cpp/conversion.h:9, from /usr/local/include/yaml-cpp/node.h:8, ...

Compiling webkit on windows : environment variable not found $(PRODUCTION)

Hi I am trying to compile webkit on windows and am running into several errors. One of them is : The following environment variables were not found: $(PRODUCTION) Does anybody know what this variable is supposed to map to? Thanks -M ...

Strange (possibly wrong?) C# compiler behavior with method overloading and enums

Hi, today I discovered a very strange behavior with C# function overloading. The problem occurs when I have a method with 2 overloads, one accepting Object and the other accepting Enum of any type. When I pass 0 as parameter, the Enum version of the method is called. When I use any other integer value, the Object version is called. I kno...

C++: How to declare an array at the top of the method?

I'd like to declare an array at the top of my method, but it's not compiling: Foo Bar() { int arr[]; // C2133 // … // C2059, C2143, C2143 arr[] = {1, 2, 3}; } What am I doing wrong here? UPDATE I know that C++ doesn't force me to do it this way, but the project's convention wants all variables declared at the top o...

Compiler error: cannot convert char* to char

i am trying to create a function like strlen() in string.h It's giving me the error can not convert char* to char #include<stdio.h> #include<conio.h> int xstrlen(char string); void main(void) { char string[40]; puts("Enter string:"); gets(string); printf(" %s is the length of %d", string, xstrlen(string)); } int xstrlen(cha...