Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Knapsack problem
#8
To compile C++ code you need a program that does it. There are many free C++ compilers and IDEs (integrated development environment).

http://www.thefreecountry.com/compilers/cpp.shtml

I tested only few, in the past:

Microsoft Visual C++ 2005/2008 Express. Don't have a resource editor, but you don't need it in this case.

Bloodshed Dev-C++.

---

Download the program. Install.

Run the program.

Create new Win32 dll project. It should create minimum code for the dll. The code should contain DllMain function.

Try to compile (Build) to see if the compiler works well. Must compile without errors. It will create a dll file somewhere in project's folder.

Below or above WinMain function, add your functions. Don't add main() function.

Before each function you want to export (and use in QM) insert extern "C" __declspec(dllexport). With non-Microsoft compilers it may not work. Then can be used def file.

Compile. Must compile without errors. If not, then you have to learn C++ and correct the code.

In QM, declare the exported functions, for example

Code:
Copy      Help
dll "$desktop$\knaps\release\knaps.dll" knapsack_hs n int*w c int*p int*z int*x

Ready to use.


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)