digitalmars.D.learn - Reference to an unresolved external symbol
- Injeckt (27/27) Sep 07 2022 Hi guys, I have an issue when I compile program with using
- rikki cattermole (1/1) Sep 07 2022 You have probably forgotten to link against user32.
- Injeckt (4/5) Sep 07 2022 I guess you right. But I don't know how i gonna link libs when
- rikki cattermole (2/8) Sep 07 2022 I think it is as simple as adding user32.lib to dmd (directly).
- Injeckt (3/12) Sep 07 2022 LOL! WTF?!? It works! Thanks Sensei.
- Dennis (5/7) Sep 07 2022 Another way is to add this to your code:
- Injeckt (5/12) Sep 07 2022 Oh thank you. I didn't knew that, I thought that it only works in
Hi guys, I have an issue when I compile program with using windows api, I got this message: "reference to an unresolved external symbol _MessageBoxW 16". I just created simple hello world using winapi and MessageBox. import core.runtime; import std.stdio; import std.string; import core.sys.windows.windows; extern(Windows) int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR cmdLine, int nCmdShow) { int result; try { Runtime.initialize(); result = myWinMain(hInstance, hPrevInstance, cmdLine, nCmdShow); Runtime.terminate(); } catch (Throwable e) { result = 0; } return result; } int myWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR cmdLine, int nCmdShow) { MessageBox(null, "Hello", "D!", MB_OK); return 0; }
Sep 07 2022
You have probably forgotten to link against user32.
Sep 07 2022
On Wednesday, 7 September 2022 at 10:01:11 UTC, rikki cattermole wrote:You have probably forgotten to link against user32.I guess you right. But I don't know how i gonna link libs when I'm using "dmd main.d". Tell me please.
Sep 07 2022
On 07/09/2022 10:14 PM, Injeckt wrote:On Wednesday, 7 September 2022 at 10:01:11 UTC, rikki cattermole wrote:I think it is as simple as adding user32.lib to dmd (directly).You have probably forgotten to link against user32.I guess you right. But I don't know how i gonna link libs when I'm using "dmd main.d". Tell me please.
Sep 07 2022
On Wednesday, 7 September 2022 at 10:31:02 UTC, rikki cattermole wrote:On 07/09/2022 10:14 PM, Injeckt wrote:LOL! WTF?!? It works! Thanks Sensei.On Wednesday, 7 September 2022 at 10:01:11 UTC, rikki cattermole wrote:I think it is as simple as adding user32.lib to dmd (directly).You have probably forgotten to link against user32.I guess you right. But I don't know how i gonna link libs when I'm using "dmd main.d". Tell me please.
Sep 07 2022
On Wednesday, 7 September 2022 at 10:14:22 UTC, Injeckt wrote:I guess you right. But I don't know how i gonna link libs when I'm using "dmd main.d".Another way is to add this to your code: ```D pragma(lib, "User32"); ```
Sep 07 2022
On Wednesday, 7 September 2022 at 10:50:17 UTC, Dennis wrote:On Wednesday, 7 September 2022 at 10:14:22 UTC, Injeckt wrote:Oh thank you. I didn't knew that, I thought that it only works in visual studio. Comrades, I need to use inet_ntop() from Ws2tcpip.h, but how I gonna include this header file to my code file?I guess you right. But I don't know how i gonna link libs when I'm using "dmd main.d".Another way is to add this to your code: ```D pragma(lib, "User32"); ```
Sep 07 2022