Spudder

Members
  • Content count

    1070
  • Joined

  • Last visited

Community Reputation

385 Neutral

About Spudder

  • Rank
    Contributor
  1. If you want to export a class from a DLL using VC++ then you would write the __declspec(dllexport) like so: class __declspec(dllexport) CTest { //blah }; I've never seen the extern "C" construct used with exporting classes so I'm not sure if it even has any effect. The primary method I've seen it used is with exporting functions from a C++ DLL. Specifying the extern "C" tells the compiler to use C style linkage for those functions so you can call them from the client application by using their original name. You only need this for C++ dlls because of the name mangling which occurs.
  2. Need help running GCC-3.0.4

    If you are running Windows then you'll need to grab yourself a copy of Cygwin or MinGW which contains the Win32 ports of the build tools you need. If your running Linux then all the tools you need will be installed as part of the distribution. Once you have the necessary build tools it's simply a matter of extracting the GCC source code, creating a temporary "obj directory" inside the source folder then run "../configure" followed by "make" and going for a coffee (or several). Attempting to build GCC from inside the source directory isn't supported, it may work if you try, but it probably wont. Configuration of GCC has plenty of options to control how it's built sefore you start I'd recommend reading the following page which can be found on the GCC home page - linky, in particular the configuration and building portions. Since you're attempting to use an old version of GCC (the current version is 4.1.1) then you may be able to find a precompiled package for your platform around although it's not terribly to build and install GCC from the source code.
  3. Visual C++ Compiler

    Assuming default installation directory the path is "C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\cl.exe". Even if you've used a different installation directory it's still a simple matter to work it out based on the path above.
  4. VB6: Access Database programming and variables.

    For searching through an array you can use a binary search which is faster than a linear search through every element in the array. Using a binary search does require the array contents be sorted which you can achieve with QuickSort for example, there are a few implementations in VB6 available on the 'Net if you Google it. Regarding your database question if you use ADO then you can do a straightforward SQL query to only return the record with the name "Jim", something like this: Dim Conn as new ADODB.Connection Dim Command as new ADODB.Command Dim RecSet as ADODB.RecordSet 'make the connection to the db Conn.Open "my connection string" Command.ActiveConnection = Conn 'run the query and get a recordset back with the record/s we want, you'll 'need to replace table_name with the name of your table Command.CommandText = "select * from table_name where names = 'jim'" RecSet = Command.Execute 'now you can pull each column back like so, just replace "names" and '"some_other_column" with the column name in question Dim Foo = RecSet("names") Dim Bar = RecSet("some_other_column) 'cleanup Conn.close This way you only pull back those records which match your criteria, you don't need to iterate through every record looking for the one your interested in. For the connection string to use take a look at ConnectionStrings.com
  5. Compiler idle/freeze

    Rather than trying to compile your code through the command line why dont you download Code::Blocks and use the toolkit through that? Also you dont link files through the compiler, you invoke cl.exe to produce a .obj file for each of your source files then pass these to link.exe along with any other required options which will produce your exe file. If you use Code::Blocks then all these details will be taken care of.
  6. I found this link a little while back when I started writing my own math library as a basis for learning more about SIMD programming. Might be worth taking a look as from the comparison chart given it does seem pretty fast - Optimised matrix library in C++.
  7. VPN Software

    EDIT: ignore me, misread thread title.
  8. question about headers...

    Quote:Original post by babbling Yes, but it is the programmer's responsibility to ensure that infinite recursion does not occur. You can do this through the use of the pre-compiler. For example, /* File: foo.h */ #ifndef _FOO_H_ #define _FOO_H_ #include "bar.h" class Foo { }; #endif /* File: bar.h */ #ifndef _BAR_H_ #define _BAR_H_ #include "foo.h" class Bar { }; #endif So when Foo gets parsed by the pre-compiler, _FOO_H_ is defined before bar.h gets included. When bar.h is included, _BAR_H_ is defined, and then foo.h is included, but this time the ifndef in foo.h fails, and so bar.h does not get included again. That's include guards, it's used to prevent the same class definition from appearing in the same translation unit (source file) which can happen if a header is inadvertently included twice - i.e include a.h, b.h and c.h in foo.cpp but c.h also includes a.h it ends up being included twice by the preprocessor. The way to solve cyclic dependency where Foo.h depends on Bar.h but Bar.h needs the class definition from Foo.h use forward declarations of the classes as has already been pointed out. The one thing to remember is you can only declare pointers to the class or a reference to it since these are the same size regardless of the class they point/reference to. Anything else like trying to create an object of a forward declared class will result in a syntax error.
  9. These new types of DVD

    When you buy a movie now on DVD, in most cases your actually buying a dual layer DVD which can contain up to 8.7GB or about 400 minutes of video and extras, otherwise films like LOTR wouldn't be able to fit onto a standard single layer DVD.
  10. Easy file format for beginers to load?

    There is a lot of information about on loading in 3DS files, a quick search on Google should give plenty of resources to use. Since this is your first attempt at a loader you might find it easier to work with text based format, both .obj and .ase are ASCII based I believe although from what I've seen there isn't as much information about those formats as for others.
  11. FMOD woes

    You can use the helper function FMOD_ErrorString() to get an error description of the last error, you pass in the return value of FMOD_GetError() to receive a char* string. Try outputting the value in a message box directly after FSOUND_Init() and after each time you create or play a sound to find out what's going wrong and why.
  12. Linux problems

    All the Linux distros I've seen come with their own partitioning software which you can often use to tell you the type of filesystem and the size of it, so if you know for example the drive you want to install Linux on is 20GB then look for a drive with that size and use that.
  13. DVD-R with DVD+R

    I've got a DVD+RW drive myself and when I entered a DVD-R to try and record to it wouldn't reconise the disc and kept asking me to insert one instead. You can buy recorders which can write to both multiple formats but AFAICT if your drive only says DVD+R then that's all you can use. Bit of a pain really when you consider the price difference in some stores between the two formats.
  14. I may be missing something obvious here but the line "BGL::ErrorCode::OK" seems like a syntax error since ErrorCode is a typedef to int, shouldn't it be "BGL::Errors::OK" instead?
  15. Compile error

    Using #pragma comment(lib, "libname.lib") is exactly the same as entering the library to the list of linker inputs through your project settings. It's all down to a matter of preference which you prefer to use although I don't think GCC supports this syntax so bear that in mind if your trying to keep your code portable. Because the function InitCommonControl() isn't defined within your own source code but rather in a dll you need to tell the linker where it can find that function when it generates the code to call it, you do this by adding in the import library (.lib) to the list of linker inputs which will then tell the linker it can resolve references to that function inside the .lib's associated dll. If the issue of dlls confuses you (and they can be a very confusing topic) then there's plenty of resources out there which you can use, Google is your friend in this situation.