gcc

executing gcc from notepad++?

Hello, How would I compile a file through notepad++, is there away i can invoke the compiler (gcc) and pass through the file onto gcc? i have gcc in C:\Program Files\gcc ...

gcc: __DATA,__const vs __TEXT,__const

According to the Mac OS X ABI Mach-O File Format Reference, __DATA,__const holds Initialized relocatable constant variables. I poked around a bit and it looks like gcc places initialized const structures and arrays in __DATA, __const. Why not __TEXT,__const, though? Koi8rModel and CI_nsJSCID, for example, are initialized const structure...

Portable equivalent to gcc's __attribute__(cleanup)

Recently I came across a gcc extension that I have found rather useful: __attribute__(cleanup) Basically, this allows you to assign a cleanup call to a local variable at the time it exits scope. For instance, given the following section of code, all memory must be maintained and handled explicitly in any and all cases within the call to...

Xcode gcc exit status 1

first of all i am very new to all this. i recently upgraded to Snow Leopard and installed the Xcode + iPhone dev package, 3.1.2. I went on to install the Django framework + MYSQLDB handler. During the build stage, the terminal shows me the gcc exit status 1 error. But I have the Xcode already installed? where am I going wrong? Also whi...

How to use protocol buffers ?

Hi , Could someone please help and tell me how to use protocol buffers. Actually I want to exchange data through sockets between a program running on unix and anoother running on windows in order to run simulation studies. The programs that use sockets to exchange data, are written in C/C++ and I would be glad if somneone could help ...

Compiling for both Intel and PPC CPUs on OSX

I have a MacBook Pro with a 64-bit Intel Core 2 Duo processor, and I'm using gcc (i686-apple-darwin9-gcc-4.0.1) to compile executables which I can run ok on my own machine. Recently someone tried to run my application on a PowerBook G4 and got a 'Bad CPU type in executable' error, which I think is because their CPU is PPC rather than Int...

Unexpected behavior of write operations when creating a custom section in EEPROM using GCC

Hello all, Here is my question, I work on an application embeded in a board we manufactured ourselves for a space project. The board uses a LEON2 Processor which is a derivate of SPARC v8 and we also use RTEMS as OS. In this application we have to save default value for various tables for the FS in the EEPROM, so the user can modify t...

Calling static pointer to a list from a shared library in c++

Hi, I have a static class member class bar {...} class foo { public: static QHash<qint64,bar>* barRepHash; } Now I call a function which accesses this member within a shared library, I get a memory error whereas when I access the function through the main program, it works fine. I've tested this under a number of circu...

MinGW/GCC Delay Loaded DLL equivalent?

Hello, I'm trying to port some old MSVC C++ code to MinGW/GCC. One problem is that the project relies heavily on the /DELAYLOAD option for functions that aren't always used, and where the proper dll is located at runtime. Is there such a similar option on MinGW/GCC? This code is targeting the windows platform. ...

What causes the "left but not entered" GCC compiler error?

We recently ran into the following compiler error that repeated at different locations throughout our build: line-map.c: file "<a source_file name>" left but not entered The source file was different at different points in the build. After some time, the compiler finally threw the following error: <header file>: In function `<functi...

Why create a .a file from .o for static linking?

Consider this code: one.c: #include <stdio.h> int one() { printf("one!\n"); return 1; } two.c: #include <stdio.h> int two() { printf("two!\n"); return 2; } prog.c #include <stdio.h> int one(); int two(); int main(int argc, char *argv[]) { one(); two(); return 0; } I want to link these programs togethe...

Assigning a "const char*" to std::string is allowed, but assigning to std::wstring doesn't compile. Why?

I assumed that std::wstring and std::string both provide more or less the same interface. So I tried to enable unicode capabilities for our application # ifdef APP_USE_UNICODE typedef std::wstring AppStringType; # else typedef std::string AppStringType; # endif However that gives me a lot of compile errors when -DAPP_USE_UNI...

Avoid slicing of exception types (C++)

I am designing an exception hierarchy in C++ for my library. The "hierarchy" is 4 classes derived from std::runtime_error. I would like to avoid the slicing problem for the exception classes so made the copy constructors protected. But apparently gcc requires to call the copy constructor when throwing instances of them, so complains abou...

Is it allowed to inherit from a class in the std namespace (namely std::wstring)?

The class std::wstring is missing some operations for "normal" c strings (and literals). I would like to add these missing operations in my own custom class: #include <string> class CustomWString : public std::wstring { public: CustomWString(const char*); const char* c_str(void); }; The code above c...

imposing library loading order

I have a gcc-compiled application linked against dynamic libraries. Is there a way to impose the order in which libraries are loaded? (In my case one library constructor uses resources set up by other library constructor). Thanks. ...

How to make String to const wchar_t* conversion function work under Windows and Linux

Hi, I work on a project written for MSVCC / Windows, that I have to port to GCC / Linux. The Project has its own String Class, which stores its Data in a QString from Qt. For conversion to wchar_t* there was originally this method (for Windows): const wchar_t* String::c_str() const { if (length() > 0) { return (const wchar...

gcc debug log files on Windows?

I am starting to ship Qt applications built using MinGW and have a question about debug logs. When using code compiled with MSVC, if my app were to crash a log file or mini-dump could be created that was invaluable when diagnosing the problem. There is even a very cool library called crashrpt that can generate and then email this log f...

GCC Compiler Warning: extended initializer lists only available with c++0x

Using this member initialization... StatsScreen::StatsScreen( GameState::State level ) : m_Level( level ) { ...// } I get the following warning... extended initializer lists only available with -std=c++0x or -std=gnu++0x Any information regarding this warning? Edit: Warning went away after I removed one of the member that w...

Getting included header file path in VC++

Environment: I am using MS-VC++ 6.0, I include a group of header file with some data. The header files change often, so on every change I change the path setting and re-compiler A log file is generated based on the included header files For tracking of the header file from the log file, I wish to print the header file path inside the l...

void has unknown size in Visual C++

In Visual Studio C++ version 9 (and probably other versions too), the following code: int a = sizeof(void); void const *b = static_cast<void const *>("hello world"); b += 6; Generates these errors: error C2070: 'void': illegal sizeof operand error C2036: 'const void *' : unknown size This code works under GCC, which treats sizeof(v...