Forum » Programiranje » linker error - Mathematica
linker error - Mathematica
slovencl ::
Imam en kratek programček ki bi ga rad poganjal iz Mathematice, ampak vedno dobim " [Linker error] undefined reference to `MLMain' "
#include "mathlink.h"
int addtwo(int i, int j) {
return i+j;
}
int main(int argc, char* argv[]) {
return MLMain(argc, argv);
}
Navodilih so napisana za MS Visual studio (jaz uporabljam Dev C++), in sem v compiler options pokazal na bin, lib in include direktorije, ampak zadeva ne deluje:
Using the Integrated Development Environment Visual Studio 2005
Steps Common to All Projects
Steps required to use MathLink with Microsoft Visual Studio 2005:
1. Copy mathlink.h from the MathLink Developer Kit to the Microsoft Visual Studio 2005 Include directory.
32-bit Windows
Developer Kit path 32-bit Windows: C:\Program Files\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows\CompilerAdditions\mldev32\include
Visual Studio 2005 Include directory 32-bit Windows: C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Include
Windows 64
Developer Kit path Windows 64: C:\Program Files (x86)\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows-x86-64\CompilerAdditions\mldev64\include
Visual Studio 2005 Include directory Windows 64: C:\Program Files (x86)\Microsoft Visual Studio 8\VC\PlatformSDK\Include
2. Copy the .lib files to the Microsoft Visual Studio Lib directory.
32-bit Windows
Copy ml32i1m.lib, ml32i2m.lib, and ml32i3m.lib from: C:\Program Files\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows\CompilerAdditions\mldev32\lib to: C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Lib
Windows 64
Copy ml64i2m.lib, and ml64i3m.lib from: C:\Program Files (x86)\Wolfram Research\Mathematica\8.0\AddOns\MathLink\DeveloperKit\Windows-x86-64\CompilerAdditions\mldev64\lib to: C:\Program Files (x86)\Microsoft Visual Studio 8\VC\PlatformSDK\Lib\AMD64
3. Copy mprep.exe.
32-bit Windows
from: C:\Program Files\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows\CompilerAdditions\mldev32\bin to: C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\bin
Windows 64
from: C:\Program Files (x86)\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows-x86-64\CompilerAdditions\mldev64\bin to: C:\Program Files (x86)\Microsoft Visual Studio 8\VC\PlatformSDK\bin
Creating a Project for addtwo.exe
To create a project solution that can be used to edit, build, and debug addtwo.exe:
1. Start Microsoft Visual Studio 2005.
2. Click File ► New ► Project.
The New Project dialog box appears.
3. In the Project Types pane click the tree expand icon next to the Visual C++ Projects. Select Win32. In the Templates pane click the Win32 Project icon.
4. In the Location text field type:
32-bit Windows
C:\Program Files\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows\MathLinkExamples
Windows 64
C:\Program Files (x86)\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows-x86-64\MathLinkExamples
In the Name text field type addtwo.
Click OK.
The Win32 Application Wizard dialog box appears.
5. Click Application Settings. Under the Additional options set, click the Empty Project text box. Click Finish.
6. Select the addtwo project in the Solution Explorer by clicking once. From the Project menu select Project ► Add Existing Item.
The Add Existing Item dialog box appears.
7. From the Look in dropdown menu select the following directory:
32-bit Windows
C:\Program Files\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows\MathLinkExamples\addtwo
Windows 64
C:\Program Files (x86)\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows-x86-64\MathLinkExamples\addtwo
8. In the File name: text box enter addtwo.c addtwo.tm separated by spaces. Click Add.
9. A prompt box might appear asking if you want to create a "New Rule" for building .tm files. Click No.
10. In the Solution Explorer drag the addtwo.tm file into the Source Files folder.
11. Select the addtwo project in the Solution Explorer by clicking once. From the Project menu select Project ► Add New Item.
The Add New Item dialog box appears.
In the Location text field add:
32-bit Windows
C:\Program Files\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows\MathLinkExamples\addtwo
Windows 64
C:\Program Files (x86)\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows-x86-64\MathLinkExamples\addtwo
In the Name: text field type addtwotm.c.
Click Add.
12. Right-click the addtwo project in the Solution Explorer and select Properties.
13. Click the Expand Tree button next to Configuration Properties.
14. Click the Expand Tree button next to Linker.
15. Click the Input entry.
16. In the Additional Dependencies text field enter ml32i3m.lib.
Click OK.
17. Click addtwo.tm in the Solution Explorer. From the Project menu select Project ► Properties.
The addtwo.tm Property Pages dialog box appears.
18. Click the Expand Tree button next to Configuration Properties.
19. Click the Expand Tree button next to Custom Build Step.
20. Click the General entry.
21. In the rightmost pane click the empty box across from the Command Line. In this text box type (include the quotes): "$(VCInstallDir)PlatformSDK\bin\mprep.exe" "$(InputPath)" -o "$(ProjectDir)..\addtwotm.c".
22. In the text field across from the Outputs text type: ..\addtwotm.c.
Click OK. After the build the file addtwotm.c will be created in the following location:
32-bit Windows
C:\Program Files\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows\MathLinkExamples\addtwo
Windows 64
C:\Program Files (x86)\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows-x86-64\MathLinkExamples\addtwo
23. Right-click the addtwo project in the SolutionExplorer and select Properties.
24. Click the Expand Tree button next to Configuration Properties.
25. Click the General entry.
26. Click the Project Defaults expand tree button.
27. Set the dropdown menu opposite Character Set to Not Set.
Click OK.
28. From the Build menu, select Build ► Build Solution.
29. After the project builds, Microsoft Visual Studio 2005 will display a dialog box informing you that the file addtwotm.c has changed and asking you if you would like to reload the file. Click Yes.
30. The addtwo.exe binary is now in:
32-bit Windows
C:\Program Files\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows\MathLinkExamples\addtwo\Debug
Windows 64
C:\Program Files (x86)\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows-x86-64\MathLinkExamples\addtwo\Debug
Creating a Project for factor.exe
To create a project solution that can be used to edit, build, and debug factor.exe:
1. Start Microsoft Visual Studio .NET.
2. Click File ► New ► Project.
The New Project dialog box appears.
3. In the Project Types pane click the tree expand icon next to the Visual C++ Projects. Select Win32. In the Templates pane click the Win32 Console Application icon.
4. In the Location text field type:
32-bit Windows
C:\Program Files\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows\MathLinkExamples
Windows 64
C:\Program Files (x86)\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows-x86-64\MathLinkExamples
In the Name text field type factor.
Click OK.
The Win32 Application Wizard dialog box appears.
5. Click Application Settings. Under the Additional options set, click the Empty Project text box. Click Finish.
6. Select the factor project in the Solution Explorer by clicking once. From the Project menu select Project ► Add Existing Item.
The Add Existing Item dialog box appears.
7. From the Look in dropdown menu select the following directory:
32-bit Windows
C:\Program Files\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows\MathLinkExamples\factor
Windows 64
C:\Program Files (x86)\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows-x86-64\MathLinkExamples\factor
8. In the File name: text box enter: factor.c.
Click Add.
9. Right-click the factor project in the Solution Explorer and select Properties.
10. Click the Expand Tree button next to Configuration Properties.
11. Click the Expand Tree button next to Linker.
12. Click the Input entry.
13. In the Additional Dependencies text field enter ml32i3m.lib.
Click OK.
14. From the Build menu, select Build ► Build Solution.
15. The factor.exe binary is now in:
32-bit Windows
C:\Program Files\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows\MathLinkExamples\factor\Debug
Windows 64
C:\Program Files (x86)\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows-x86-64\MathLinkExamples\factor\Debug
#include "mathlink.h"
int addtwo(int i, int j) {
return i+j;
}
int main(int argc, char* argv[]) {
return MLMain(argc, argv);
}
Navodilih so napisana za MS Visual studio (jaz uporabljam Dev C++), in sem v compiler options pokazal na bin, lib in include direktorije, ampak zadeva ne deluje:
Using the Integrated Development Environment Visual Studio 2005
Steps Common to All Projects
Steps required to use MathLink with Microsoft Visual Studio 2005:
1. Copy mathlink.h from the MathLink Developer Kit to the Microsoft Visual Studio 2005 Include directory.
32-bit Windows
Developer Kit path 32-bit Windows: C:\Program Files\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows\CompilerAdditions\mldev32\include
Visual Studio 2005 Include directory 32-bit Windows: C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Include
Windows 64
Developer Kit path Windows 64: C:\Program Files (x86)\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows-x86-64\CompilerAdditions\mldev64\include
Visual Studio 2005 Include directory Windows 64: C:\Program Files (x86)\Microsoft Visual Studio 8\VC\PlatformSDK\Include
2. Copy the .lib files to the Microsoft Visual Studio Lib directory.
32-bit Windows
Copy ml32i1m.lib, ml32i2m.lib, and ml32i3m.lib from: C:\Program Files\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows\CompilerAdditions\mldev32\lib to: C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Lib
Windows 64
Copy ml64i2m.lib, and ml64i3m.lib from: C:\Program Files (x86)\Wolfram Research\Mathematica\8.0\AddOns\MathLink\DeveloperKit\Windows-x86-64\CompilerAdditions\mldev64\lib to: C:\Program Files (x86)\Microsoft Visual Studio 8\VC\PlatformSDK\Lib\AMD64
3. Copy mprep.exe.
32-bit Windows
from: C:\Program Files\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows\CompilerAdditions\mldev32\bin to: C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\bin
Windows 64
from: C:\Program Files (x86)\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows-x86-64\CompilerAdditions\mldev64\bin to: C:\Program Files (x86)\Microsoft Visual Studio 8\VC\PlatformSDK\bin
Creating a Project for addtwo.exe
To create a project solution that can be used to edit, build, and debug addtwo.exe:
1. Start Microsoft Visual Studio 2005.
2. Click File ► New ► Project.
The New Project dialog box appears.
3. In the Project Types pane click the tree expand icon next to the Visual C++ Projects. Select Win32. In the Templates pane click the Win32 Project icon.
4. In the Location text field type:
32-bit Windows
C:\Program Files\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows\MathLinkExamples
Windows 64
C:\Program Files (x86)\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows-x86-64\MathLinkExamples
In the Name text field type addtwo.
Click OK.
The Win32 Application Wizard dialog box appears.
5. Click Application Settings. Under the Additional options set, click the Empty Project text box. Click Finish.
6. Select the addtwo project in the Solution Explorer by clicking once. From the Project menu select Project ► Add Existing Item.
The Add Existing Item dialog box appears.
7. From the Look in dropdown menu select the following directory:
32-bit Windows
C:\Program Files\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows\MathLinkExamples\addtwo
Windows 64
C:\Program Files (x86)\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows-x86-64\MathLinkExamples\addtwo
8. In the File name: text box enter addtwo.c addtwo.tm separated by spaces. Click Add.
9. A prompt box might appear asking if you want to create a "New Rule" for building .tm files. Click No.
10. In the Solution Explorer drag the addtwo.tm file into the Source Files folder.
11. Select the addtwo project in the Solution Explorer by clicking once. From the Project menu select Project ► Add New Item.
The Add New Item dialog box appears.
In the Location text field add:
32-bit Windows
C:\Program Files\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows\MathLinkExamples\addtwo
Windows 64
C:\Program Files (x86)\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows-x86-64\MathLinkExamples\addtwo
In the Name: text field type addtwotm.c.
Click Add.
12. Right-click the addtwo project in the Solution Explorer and select Properties.
13. Click the Expand Tree button next to Configuration Properties.
14. Click the Expand Tree button next to Linker.
15. Click the Input entry.
16. In the Additional Dependencies text field enter ml32i3m.lib.
Click OK.
17. Click addtwo.tm in the Solution Explorer. From the Project menu select Project ► Properties.
The addtwo.tm Property Pages dialog box appears.
18. Click the Expand Tree button next to Configuration Properties.
19. Click the Expand Tree button next to Custom Build Step.
20. Click the General entry.
21. In the rightmost pane click the empty box across from the Command Line. In this text box type (include the quotes): "$(VCInstallDir)PlatformSDK\bin\mprep.exe" "$(InputPath)" -o "$(ProjectDir)..\addtwotm.c".
22. In the text field across from the Outputs text type: ..\addtwotm.c.
Click OK. After the build the file addtwotm.c will be created in the following location:
32-bit Windows
C:\Program Files\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows\MathLinkExamples\addtwo
Windows 64
C:\Program Files (x86)\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows-x86-64\MathLinkExamples\addtwo
23. Right-click the addtwo project in the SolutionExplorer and select Properties.
24. Click the Expand Tree button next to Configuration Properties.
25. Click the General entry.
26. Click the Project Defaults expand tree button.
27. Set the dropdown menu opposite Character Set to Not Set.
Click OK.
28. From the Build menu, select Build ► Build Solution.
29. After the project builds, Microsoft Visual Studio 2005 will display a dialog box informing you that the file addtwotm.c has changed and asking you if you would like to reload the file. Click Yes.
30. The addtwo.exe binary is now in:
32-bit Windows
C:\Program Files\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows\MathLinkExamples\addtwo\Debug
Windows 64
C:\Program Files (x86)\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows-x86-64\MathLinkExamples\addtwo\Debug
Creating a Project for factor.exe
To create a project solution that can be used to edit, build, and debug factor.exe:
1. Start Microsoft Visual Studio .NET.
2. Click File ► New ► Project.
The New Project dialog box appears.
3. In the Project Types pane click the tree expand icon next to the Visual C++ Projects. Select Win32. In the Templates pane click the Win32 Console Application icon.
4. In the Location text field type:
32-bit Windows
C:\Program Files\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows\MathLinkExamples
Windows 64
C:\Program Files (x86)\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows-x86-64\MathLinkExamples
In the Name text field type factor.
Click OK.
The Win32 Application Wizard dialog box appears.
5. Click Application Settings. Under the Additional options set, click the Empty Project text box. Click Finish.
6. Select the factor project in the Solution Explorer by clicking once. From the Project menu select Project ► Add Existing Item.
The Add Existing Item dialog box appears.
7. From the Look in dropdown menu select the following directory:
32-bit Windows
C:\Program Files\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows\MathLinkExamples\factor
Windows 64
C:\Program Files (x86)\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows-x86-64\MathLinkExamples\factor
8. In the File name: text box enter: factor.c.
Click Add.
9. Right-click the factor project in the Solution Explorer and select Properties.
10. Click the Expand Tree button next to Configuration Properties.
11. Click the Expand Tree button next to Linker.
12. Click the Input entry.
13. In the Additional Dependencies text field enter ml32i3m.lib.
Click OK.
14. From the Build menu, select Build ► Build Solution.
15. The factor.exe binary is now in:
32-bit Windows
C:\Program Files\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows\MathLinkExamples\factor\Debug
Windows 64
C:\Program Files (x86)\Wolfram Research\Mathematica\8.0\SystemFiles\Links\MathLink\DeveloperKit\Windows-x86-64\MathLinkExamples\factor\Debug
Vredno ogleda ...
Tema | Ogledi | Zadnje sporočilo | |
---|---|---|---|
Tema | Ogledi | Zadnje sporočilo | |
» | Undo za ComboFixOddelek: Pomoč in nasveti | 1743 (1508) | MrStein |
» | [Android SDK]+[NetBeans][verzija 7.1.1]Project Compile ErrorOddelek: Programiranje | 1269 (1177) | KernelPanic |
» | Dober Singleplayer campain FPS špil?Oddelek: Igre | 4674 (3848) | Bor H |
» | problem z odpiranjem strani v IEOddelek: Omrežja in internet | 1960 (1775) | bbf |
» | Pomoč! Urgentno - sistem okužen, sesuva se na 10 - 20 min BSODOddelek: Pomoč in nasveti | 2243 (1965) | ___ |