Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

Multi File editing

<< < (12/18) > >>

Pecan:

--- Quote from: DrewBoo on August 18, 2008, 11:48:02 pm ---CodeSnippets did not build, however it never has been buildable, as it uses nonstandard C++.

--- End quote ---

What part of CodeSnippets is nonstandard C++ ?

Maybe we can fix that if we knew what you mean.

DrewBoo:

--- Quote from: Pecan on August 19, 2008, 02:00:29 am ---What part of CodeSnippets is nonstandard C++ ?

Maybe we can fix that if we knew what you mean.

--- End quote ---

 :lol:  I guess i was being a bit coy with that.  I just didn't want to threadjack this already-awesome thread.

The forum gods can bump this to its own topic if they so decide.

Let me get something easy out of the way first. src/sdk/scripting/sqplus/SquirrelVM.cpp needs to include <string.h>.  Just throw it at the top and all is fine.

You can see string functions being used early in that file.  It's probably a safe guess that Windows and popular Linux build environments are including that indirectly, so that omission hasn't been noticed.

I'll be back here in a bit after I have time to reproduce the CodeSnippits issues.




Der Meister:

--- Quote from: DrewBoo on August 19, 2008, 06:06:24 pm ---Let me get something easy out of the way first. src/sdk/scripting/sqplus/SquirrelVM.cpp needs to include <string.h>.  Just throw it at the top and all is fine.

--- End quote ---
I don't see any functions in this file which require this header file. Could you please specify the line you are talking about?
Anyway, including <string.h> in a C++ source file is always an error. Either include <string> which is the header file containing std::string or include <cstring> which is the correct file if the C-header file <string.h> is needed.

DrewBoo:

--- Quote from: Pecan on August 19, 2008, 02:00:29 am ---What part of CodeSnippets is nonstandard C++ ?

Maybe we can fix that if we knew what you mean.

--- End quote ---

In memorymappedfile.cpp, you'll see that every function has separate Windows code and Linux code.  It follows this pattern:


--- Code: ---#ifdef __WXMSW__
  // (Code intended to build in Windows)
#else
  // (Code intended to build in Linux)
#endif

--- End code ---


Since __WXMSW__ is not defined, my build blows up trying to build Linux-specific code.


--- Code: ---../memorymappedfile.cpp: In member function 'long int wxMemoryMappedFile::MapFile(const wxString&, bool)':
../memorymappedfile.cpp:107: error: 'open' was not declared in this scope
../memorymappedfile.cpp:124: error: 'MAP_FILE' was not declared in this scope

--- End code ---

Thought #1:  Does wxWindows include a file operation API so we can outright eliminate this fragile code?

Thought #2:  I've read that MAP_FILE is legacy and is #defined as 0.  Can someone verify this? 

I don't know what this would break on other platforms, but I'm adding this code to the file and am trying a build now....


--- Code: ---#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#ifndef MAP_FILE
     #define MAP_FILE 0
#endif

--- End code ---

DrewBoo:

--- Quote from: Der Meister on August 19, 2008, 06:32:56 pm ---I don't see any functions in this file which require this header file. Could you please specify the line you are talking about?

--- End quote ---

Can do.  Here's the build output from what's in the svn trunk.


--- Code: ---SquirrelVM.cpp: In static member function 'static SquirrelObject SquirrelVM::CompileBuffer(const SQChar*, const SQChar*)':
SquirrelVM.cpp:109: error: 'strlen' was not declared in this scope

--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version