Hello
I'm coming back to C++ after long years spent on other technologies and i'm stuck on some weird behavior when calling some methods taking std::string as parameters :
An example of call :
LocalNodeConfiguration *LocalNodeConfiguration::ReadFromFile(std::string & path)
{
// ...
throw configuration_file_error(string("Configuration ...
I was trying to use the random function in Ubuntu compiling with g++ on a larger program and for some reason rand just gave weird compile errors. For testing purposes I made the simplest program I could and it still gives errors.
Program:
#include <iostream>
using std::cout;
using std::endl;
#include <cstdlib>
int main()
{
cout ...
I am trying to define a full specialization of std::basic_string< char, char_traits<char>, allocator<char> > which is typedef'd (in g++) by the <string> header.
The problem is, if I include <string> first, g++ sees the typedef as an instantiation of basic_string and gives me errors. If I do my specialization first then I have no issues...
Hello
I'm trying to start with autoconf / automake for a new project. To get started, I'm reading "Using GNU Autotools" and trying to build the Hello-World-Tutorial.
The required files from page 96 (real Page=105 because it's a LaTeX-Presentation) configure.ac, Makefile.am and src/Makefile.am look exactly as stated in the document.
Af...
Hi. I'm trying to compile code in g++ and I get the following errors:
In file included from scanner.hpp:8,
from scanner.cpp:5:
parser.hpp:14: error: ‘Scanner’ does not name a type
parser.hpp:15: error: ‘Token’ does not name a type
Here's my g++ command:
g++ parser.cpp scanner.cpp -Wall
Here's parser.hpp:
#ifndef PA...
I am using cygwin libraries to run C and C++ programs on Windows.
gcc runs fine, but with g++, I get a long list of errors. I think these erros are because of linking problems with C libraries.
Can you suggest what I need to do to fix this?
beginning error lines:
In file included from testgpp.cpp:1:
/cygdrive/c/cygwin/bin/../lib/gc...
I am building using zlib.h which I have a local copy to v1.2.5, but in /usr/include/zlib.h there is v1.2.1.2.
If I omit adding -I/my/path/to/zlib to my make I get error from using old version which doesn't have Z_FIXED:
g++ -g -Werror -Wredundant-decls -D_FILE_OFFSET_BITS=64 -c -o ARCH.linux_26_i86/debug/sysParam.o sysParam.cpp
sysPara...
This might be a silly question, but...
I've been writing a number of classes that utilize non-copyable members. These classes are never initialized via the copy constructor in my source. When I try to compile without supplying my own copy-constructor, g++ throws out many errors about how it can't build a default copy constructor, due ...
What does '#if _LFS64_LARGEFILE-0' mean to the C Preprocessor for g++? Is that a minus zero or is that part of the symbol? If it is minus zero, how does that affect whether the #if is triggered?
...
I'm compiling a c++ program using g++ and ld. I have a .so library I want to be used during linking. However, a library of the same name exists in /usr/local/lib, and ld is choosing that library over the one I'm directly specifying. How can I fix this?
For the examples below, my library file is /my/dir/libfoo.so.0. Things I've tried tha...
I'm using
Ubuntu Server 9.10
AMD Phenom 2 cpu
g++ (Ubuntu 4.4.1-4ubuntu9) 4.4.1
trying to run the application pftp-shit v 1.11, which runs successfully until the remote file list is going to be saved (into .pftp//pftpfxp--).
The following code in tcp.cc is executed successfully:
int outfile_fd = open(name, O_CREAT | O_TRUNC | O_RDWR |...
I recently switched to Linux and wanted to compile my Visual Studio 2010 C++ source code, which uses only the STL, on G++.
My Linux machine currently isn't available but I can try to tell you what is going on, first:
As I try to compile my project, all global variables I use in main and which perfectly work on MSVC result in myGlobalV...
In general, I want warnings of unsigned vs signed.
However, in this particular case, I want it suppressed;
std::vector<Blah> blahs;
for(int i = 0; i < blahs.size(); ++i) { ...
I want to kill this comparison.
Thanks!
(using g++)
...
Using boost 1.4.2 asio in a c++ app and getting linux compiler warnings i don't grok.
still here?
The app i'm working on needs a "socket" that might be an ssl socket or a regular tcp socket so we hide specifics
behind a template "socket" class that takes either an ssl socket class or
tcp socket class as template parameter - below is the...
We have a body of C++ code which is being ported from a RHEL4-based distro to RHEL-5-based.
It used to compile with g++ 3.4.3, and now compiles with g++ 4.1.2.
It turns out that there are local POD variables that are being used uninitialized, which is causing
failures under the new environment -- not surprising, since C++ rules say that ...
I noticed that there are two ways to create C++ objects:
BTree *btree = new BTree;
and
BTree btree;
From what I can tell, the only difference is in how class objects are accessed (. vs. -> operator), and when the first way is used, private integers get initialized to 0.
Which way is better, and what's the difference?
How do you k...
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...
I was wondering which is the default memory allocator in G++ 4.4.1, on Ubuntu 9.1. I am interested in comparing different C++ allocators in a multithreaded environment. And where can I get more information about the default memory allocator?
EDIT: I refer to new and delete operators. The only linking is to rt and pthread
Regards
...
I do not understand the documentation for gprof regarding how to compile your program for profiling with gprof. In g++, is it required to compile with the -g option (debugging information) in a addition to the -pg option or not. In each case I get different results, and I would like to see where the bottlenecks in my application are in r...
Can I install an older version of gcc/g++ (4.1.3) on the latest Ubuntu (which comes with 4.4.3) and use it to compile a .so which should run on CentOS? The binary compiled with the Ubuntu version of gcc fails to load on CentOS because of missing imports (GLIB_2_11, ...). I need C++ (including exceptions), so I can't just statically link ...