Need help to be able to compile certain stuff (read thread)

Get help with the installation and running of the Zeus IDE. Please do not post bug reports or feature requests here. When in doubt post your question here.
Post Reply
FrozenSnake
Posts: 2
Joined: Wed Oct 08, 2008 3:29 am

Need help to be able to compile certain stuff (read thread)

Post by FrozenSnake »

I am new with this editor and using g++ from cygnus (cygwin-b20)
and I wanna be able to compile winapi applications like this:

Code: Select all

#include <windows.h>
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
char szClassName[ ] = "WindowsApp";
int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil)
{
    HWND hwnd;
    MSG messages;
    none wincl;

    wincl.hInstance = hThisInstance;
    wincl.lpszClassName = szClassName;
    wincl.lpfnWndProc = WindowProcedure;
    wincl.style = CS_DBLCLKS;
    wincl.cbSize = sizeof (none);
    wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
    wincl.lpszMenuName = NULL;
    wincl.none = 0;
    wincl.cbWndExtra = 0;
    wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;

    if (!none (&wincl))
        return 0;

    hwnd = CreateWindowEx (
           0, szClassName, "Windows App", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 544, 375, HWND_DESKTOP, NULL, hThisInstance, NULL);

    ShowWindow (hwnd, nFunsterStil);

    while (GetMessage (&messages, NULL, 0, 0))
    {
        TranslateMessage(&messages);
        DispatchMessage(&messages);
    }
    return messages.wParam;
}

LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message)                
    {
        case WM_DESTROY:
            PostQuitMessage (0);
            break;
        default:
            return DefWindowProc (hwnd, message, wParam, lParam);
    }

    return 0;
}
And later on even openGL, DirectX applications etc.
When I compile the source above in my other IDE it works perfect but when I use Zeus it give me a list of errors.
cct3VRCQ.o(.text+0x3c):main.cc: undefined reference to `LoadIconA@8'
cct3VRCQ.o(.text+0x4d):main.cc: undefined reference to `LoadIconA@8'
cct3VRCQ.o(.text+0x5e):main.cc: undefined reference to `LoadCursorA@8'
cct3VRCQ.o(.text+0x88):main.cc: undefined reference to `none@4'
cct3VRCQ.o(.text+0xd0):main.cc: undefined reference to `CreateWindowExA@48'
cct3VRCQ.o(.text+0xe2):main.cc: undefined reference to `ShowWindow@8'
cct3VRCQ.o(.text+0xf1):main.cc: undefined reference to `GetMessageA@16'
cct3VRCQ.o(.text+0x105):main.cc: undefined reference to `TranslateMessage@4'
cct3VRCQ.o(.text+0x10e):main.cc: undefined reference to `DispatchMessageA@4'
cct3VRCQ.o(.text+0x138):main.cc: undefined reference to `PostQuitMessage@4'
cct3VRCQ.o(.text+0x151):main.cc: undefined reference to `DefWindowProcA@16'
I guess I am missing something, but I have no idea what. I want it as simple as possible to compile code that uses stuff like directX or openGL.
So anyone know how I can get it to work with Zeus?

My compiler details command line say: g++.exe -c "$fn"
Maybe it's here the error are located?

The scale of "Keep/Uninstall" will weigh heavy for one of them if this is either easy to fix or hard. So If possible keep it simple I will probably consider to buy a license if I get this to work.
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

The only way I could get the MSVC compiler to compile your code was to make these changes to the code (see the ?? below):

Code: Select all

#include <windows.h>
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
char szClassName[ ] = "WindowsApp";
int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil)
{
    HWND hwnd;
    MSG messages;
//??    none wincl;
    none wincl;

    wincl.hInstance = hThisInstance;
    wincl.lpszClassName = szClassName;
    wincl.lpfnWndProc = WindowProcedure;
    wincl.style = CS_DBLCLKS;
//??    wincl.cbSize = sizeof (none);
    wincl.cbSize = sizeof (wincl);
    wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
    wincl.lpszMenuName = NULL;
//??    wincl.none = 0;
    wincl.cbWndExtra = 0;
    wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;

//??    if (!none (&wincl))
    if (!none(&wincl))

        return 0;

    hwnd = CreateWindowEx (0, szClassName, "Windows App", WS_OVERLAPPEDWINDOW,
                           CW_USEDEFAULT, CW_USEDEFAULT, 544, 375, HWND_DESKTOP,
                           NULL, hThisInstance, NULL);

    ShowWindow (hwnd, nFunsterStil);

    while (GetMessage (&messages, NULL, 0, 0))
    {
        TranslateMessage(&messages);
        DispatchMessage(&messages);
    }
    return messages.wParam;
}

LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message)
    {
        case WM_DESTROY:
            PostQuitMessage (0);
            break;
        default:
            return DefWindowProc (hwnd, message, wParam, lParam);
    }

    return 0;
}
I am not sure what the none item is that is found in your original code :?:
cct3VRCQ.o(.text+0x3c):main.cc: undefined reference to `LoadIconA@8'

This to me looks like a linker error :?

To resolve this you would need to link against the user32.lib file.

I am guessing that you could try changing the compile line to include this library as follows:

g++.exe -c "$fn" user32.lib

But really this is nothing better than my guess.

If this is a linker error then to me it means it is time to create a make file to control the build of your project: Understanding Make Files
The scale of "Keep/Uninstall" will weigh heavy for one of them if this is either easy to fix or hard. So If possible keep it simple I will probably consider to buy a license if I get this to work.
With a bit of configuration it is generally alwyas possible to run any build process from the command line, which means that same build process will also work just fine from within Zeus ;)

But unlike the other IDE that you refer, Zeus relies on the programmer to configure the build process. It is unlike the other IDE that hardcodes this build process into the IDE itself.

So the choice is pretty simple. If you want to take the time to understand and learn how to use your command line development tools to create a build process then Zeus will be good for you :)

But if you have no time for configuring command line tools then an IDE that hides these details is are a far better option for you.

Cheers Jussi
FrozenSnake
Posts: 2
Joined: Wed Oct 08, 2008 3:29 am

Post by FrozenSnake »

jussij wrote:I am not sure what the none item is that is found in your original code :?:
It's the code from Dev-Cpp when you create a new Window Application.
jussij wrote:But unlike the other IDE that you refer, Zeus relies on the programmer to configure the build process. It is unlike the other IDE that hardcodes this build process into the IDE itself.
It's possible to edit the commands in Dev-Cpp for compiling, I am not sure in how much because I have never needed to edit them.
jussij wrote:So the choice is pretty simple. If you want to take the time to understand and learn how to use your command line development tools to create a build process then Zeus will be good for you :)

But if you have no time for configuring command line tools then an IDE that hides these details is are a far better option for you.

Cheers Jussi
Hmm then this IDE is overkill for me at the moment :P I want to practise the basics in c++ first :) later on I might buy this IDE.

Thanks for the reply
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij »

I found out what the none stuff is all about ;)

It appears there is a bug in the phpBB forum application because for some reason it insists on converting certain words to none :?

FWIW I also create a tutorial of how to write a simple make file: http://www.zeusedit.com/forum/viewtopic.php?t=300

Cheers Jussi
Post Reply