hi there, I'm coding in windows, c++, but when I traslate my code to ubuntu, g++, I get this error: [B]lvalue required as left operand of assigment[/B] This is the line where I get the error: [COLOR="Red"][/COLOR][CODE]&*raiz=&*p;[/CODE] What could be the problem? *raiz and *p are pointers to an avl structure: [CODE] typedef struct nodo{ int dato; int fe; int color; struct nodo *izq; struct nodo *der; struct nodo *padre; }nodo; typedef struct nodo *avl; [/CODE] and this is the method where I have the problem: [CODE] void RSD(avl *raiz){ avl *p; p=new avl; *p=NULL; avl *q; q=new avl; *q=NULL; …

Member Avatar
Member Avatar
+0 forum 11

I'm reading 'C++ For Dummies 7th Edu' and I'v ran into this little snipet that's confusing me. BOOK You can add const-ness, however, as in the following void fn(char* pName) { // declare following is allowed even though // declared Student(const char*) Student s(pName); // ...do whatever... } The function fn() passes a char\* string to a constructor that promises to treat the string as if it were a constant. /BOOK The example before this used a constructor that was almost identical `Student(const* pName)`. The only difference I see is that the Student constructor in the fn() function doesn't have …

Member Avatar
Member Avatar
+0 forum 2

I hot the following program from the book 'C++ For Dummies' but have two questions about it. First I compiled the program but I'm afraid to run because the memery created from the heap does not appear to me to get de-allocated. Am I correct in not wanting to run this and is my reason valid? Secondly, on the line `Student* pS = new Student;` is it alway a rule that memory created from the heap must be access via a pointer? I know when I removed the `*` I get the following error from g++. `constructor.cpp:30:22: error: conversion from …

Member Avatar
Member Avatar
+0 forum 5

Linux Mint 17 I have recently download the SFML library but I don't know where to put the files. There is a lib directory and an include directory. The lib directory appears to have a lot of sym links in it. garrett@mint-desktop ~/Desktop/SFML-2.3.2/lib $ ls -l total 904 lrwxrwxrwx 1 garrett garrett 20 Oct 27 17:10 libsfml-audio.so -> libsfml-audio.so.2.3 lrwxrwxrwx 1 garrett garrett 22 Oct 27 17:10 libsfml-audio.so.2.3 -> libsfml-audio.so.2.3.2 -rw-r--r-- 1 garrett garrett 144296 Sep 11 06:40 libsfml-audio.so.2.3.2 lrwxrwxrwx 1 garrett garrett 23 Oct 27 17:10 libsfml-graphics.so -> libsfml-graphics.so.2.3 lrwxrwxrwx 1 garrett garrett 25 Oct 27 17:10 libsfml-graphics.so.2.3 -> …

Member Avatar
Member Avatar
+0 forum 4

Consider the following code: #include<stdio.h> #define msizeof(type) ((char*)(&type) - (char*)(&type - 1)) int main() { int x; printf("%u %u\n", msizeof(x), sizeof(x)); return 0; } The Above code when compiled with g++ compiles just fine and works well without any wanrings, while in gcc it gives the following warning: `integer overflow in expression`. Though the code works fine on running. This warning goes away when I change the macro to: `#define msizeof(type) ((char*)(&type + 1) - (char*)(&type))`. My Questions: 1. What does the warning `integer overflow in expression` mean? 2. Why am I getting it? 3. Why does changing it to …

Member Avatar
Member Avatar
+0 forum 6

Hi)I've been using Codeblocks for a long time;since I configured the Toolchain executables shortly after installing I had no problems with compiler;but now when I try to compile a program, codeblocks responds with a statements about wrong compiler path;when I try to run a program it responds with "Target uses an invalid compiler; run aborted";I've checked compilers and their pathes and - everything is correct..can anyone tell me how to fix this?

Member Avatar
+0 forum 0

iam trying to optimize a code i want to run code for arm_no=1000, its running for 100 arms but further increasing causes segmentation fault core dumped. to run the code use $ g++ Epsilon_greed.cpp -lm `gsl-config --libs` $ ./a.out but you'll have to install libgsl0 i.e gnu scientific library. #include<stdio.h> #include<math.h> #include<stdlib.h> #include<iostream> #include<gsl/gsl_randist.h> using namespace std; const gsl_rng_type * T; gsl_rng * r; double Epsilon; const int arm_no=10; const int play_no=1000; const int bandit_no=2000; //Action class //Each actuion corresponds to one arm class Action { private: double mean_reward;//its for calculating Qt(a) int no_chosen;//no of times an action is been …

Member Avatar
Member Avatar
+0 forum 8

I have several files to include from a subfolder and I just can't get this to work. I'm propably missing something here... The Makefile and .cpp with main function are located at /path/to/ and files to be included are at /path/to/src/buffer and /path/to/src/hash. Both of these folders have .cpp and .h for respective class. I've had no problems compiling until I put this whole project together and made a single Makefile for them. Here's my try on the Makefile: objects = delta.o hash.o buffer.o buffer_dir = path/to/src/buffer hash_dir = path/to/src/hash delta: $(objects) g++ -g -o $(objects) delta.o: delta.cpp buffer.o hash.o …

Member Avatar
Member Avatar
+0 forum 1

Hi all, To begin, I'm not certain this is the proper place to start this question, but I believe this to be a linux-linker related error rather than a code based one. I've also searched far and wide for a solution online, but others have solved the problem simply include -lblob in the build which I have already done without success. I'm using cvblobslib with openCV, and as per their instructions I've compiled their code to create libblob.a. I've copied this into /usr/local/lib and executed 'sudo ldconfig'. This should have registered the library. Here are the relevent snippets from the …

Member Avatar
Member Avatar
+0 forum 1

Hello everyone, I am working my way through the Forger's Win32 tutorial and am on the "Creating a Simple Application" part currently. I am using C++ (instead of C in the tutorial) and the WinGW compiler. When I compile the below code I get this error: main.cpp: In function 'LRESULT WndProc(HWND, UINT, WPARAM, LPARAM)': main.cpp:26:47: error: invalid conversion from 'HGDIOBJ {aka void*}' to 'HFONT' [-fpermissive] If I change the line to a cast: hfDefault = (HFONT)GetStockObject(DEFAULT_GUI_FONT); The error changes to: undefined reference to 'GetStockObject@4' collect2: ld returned 1 exit status I have searched around on Google and haven't found a …

Member Avatar
Member Avatar
+0 forum 3

So, I just did a fresh install of ubuntu 11.10, and am in the process of reinstalling gsl. For some reason, my old make file seems not to work, and am trying to figure out how to change it. Last time I had a similar problem, people in here were very helpful in figuring it out, so I've got my fingers crossed :) The call to g++ is: [CODE]g++ -Wall -lgsl -lgslcblas -lm -L/usr/lib -I /usr/include/gsl -o main main.o neuron.o network.o synapse.o dataAnalysis.o [/CODE] Resulting in: [CODE]neuron.o: In function `neuron::updateSpikeTime()': /home/kaare/LIFnetworks/neuron.cpp:123: undefined reference to `gsl_root_fsolver_set' /home/kaare/LIFnetworks/neuron.cpp:131: undefined reference to `gsl_root_fsolver_iterate' …

Member Avatar
Member Avatar
+0 forum 5

Hey all! I was thinking about how to make a program, in which you write some c++ code and program tests that code with given examples. For example you input following code in that program: [CODE]#include <iostream> using namespace std; int main() { int a, b; cin >> a >> b; cout << a + b; return 0; } [/CODE] the program compiles and tests the code (for example it tests if you input 1 and 3, will 4 be written in console using that code) and gives you information if the program is working or not. Or in other …

Member Avatar
Member Avatar
+0 forum 2

How do I do assembly code with the mingw-g++ compiler. All the websites I checked say that this should work: [CODE]int add(int a, int b) { int c=0; asm("mov %[aVal],%eax;add %[bVal],%eax;mov %eax,%[cVal]" : [cVal] "=i" (c) : [bVal] "i" (b) : [aVal] "i" (a)); return c; }[/CODE] But instead I get the following compiler errors: D:\Programming\C++\test\main.cpp||In function 'int add(int, int)':| D:\Programming\C++\test\main.cpp|10|error: expected string-literal before '[' token| D:\Programming\C++\test\main.cpp|10|error: expected ')' before '[' token| D:\Programming\C++\test\main.cpp|10|error: undefined named operand 'aVal'| D:\Programming\C++\test\main.cpp|4|warning: unused parameter 'a'| ||=== Build finished: 3 errors, 1 warnings ===| What is wrong with that code? How do I do assembly …

Member Avatar
Member Avatar
+0 forum 1

I haven't coded something this complex in C++ before and I haven't had time to really review. I'm making a game (well, foundations for a game anyway), with an external game library, Allegro. But I think the problems I'm having is more fundamental to C++ in general. Included is a .zip of my program but I'm curious how I should utilize the following: The code has a main and 2 headers. Both are meant to be objects. One object controls a player on the screen, specifically its behaviors. The other controls the animation itself. I don't see a need to …

Member Avatar
Member Avatar
+0 forum 11

Hi.I get the following error "g++: error: CreateProcess no such file or directory" whenever i try to compile a program.I have installed the MinGw 7.2 version at work on a windows machine and the problem does not occur , however after installing windows SP3 on my home computer i get this error and i just can't figure it out since i have set all the environment variables properly.I tried setting the path to "C:\MinGw\libexec\gcc\i686-mingw32\4.6.1" where cc1plus.exe and cc1.exe are located but still no luck.If i type this at the command line: [code] >_assoc .cpp=cpls >_ftype cpls=g++ "%1" %* >_program.cpp [/code] …

Member Avatar
+0 forum 0

Hi. I'm making small application what will do c++ programs compiling easier. I have this code: [CODE]System.Diagnostics.Process.Start("C:\\Alps\\compiler\\H-i586-cygwin32\\bin\\g++.exe", "-c Main.cpp -o main.o ");[/CODE] This code should start [CODE]g++.exe[/CODE] with arguments [CODE]-c Main.cpp -o main.o[/CODE] for compiling main cpp file to o file. Can you see any error in my code? Why it does not works? When I will click to button what contains this code, nothing happens. Main.cpp file is there and g++.exe too. Path is good.

Member Avatar
Member Avatar
+0 forum 2

[IMG]http://i1187.photobucket.com/albums/z394/crazythang/photo-1.jpg[/IMG] i try to compile a simple c++ hello world, and i get this, PLZ HELP i compile with g++...

Member Avatar
Member Avatar
+0 forum 5

I'm using a cross-compiler that generates MIPS binaries from c++ (mipseb-linux-g++). What I want to do is tell the compiler to use a specific ISA (namely MIPS I). From what I can tell this is a machine option that should be easily configurable. I've tried changing the option in my Makefile but the compiler is still generating instructions from the MIPS II ISA which apparently is default. None of my compiler flags are working. Am I doing something wrong? Here's my Makefile just for reference: [CODE] ############################################################################## # \author acc@cs.rochester.edu # \version 0.01 # \brief ############################################################################## # Environment variables which …

Member Avatar
+0 forum 0

The End.