How did you generate your project files? I generally using CMake to create the 
sln and cproject files automatically as it is otherwise a bit of a chore. Also, 
CMake is IUP's native build system, which can be helpful.

Another question is, how did you obtain IUP? My recommendation is to use PMM to 
get all dependencies automatically, including IUP itself, from an appropriate 
package source such as vcpkg.

https://github.com/vector-of-bool/pmm

This should be a good starting point (not at my main machine right now so I 
can't easily access my very messy project files to ensure this is 100% correct 
but let me know if it doesn't work):

********** CMakeLists.txt **********

```cmake
cmake_minimum_required(VERSION 3.15)
project(iup_example)

set(CMAKE_CXX_STANDARD 17)

# Include PMM
include(pmm.cmake)
pmm(VCPKG
    PACKAGES
        iup
        cd
        im
)

# Find packages
find_package(IUP CONFIG REQUIRED)
find_package(CD CONFIG REQUIRED)
find_package(IM CONFIG REQUIRED)

# Add the executable
add_executable(iup_example main.cpp)

# Link libraries
target_link_libraries(iup_example PRIVATE 
    IUP::iup 
    IUP::iupcontrols
    IUP::iupcd
    IUP::iupim
    CD::cd
    IM::im
)

# Copy LED file to build directory
configure_file(${CMAKE_SOURCE_DIR}/example.led ${CMAKE_BINARY_DIR}/example.led 
COPYONLY)
```

********** main.cpp **********

```cpp
#include <iup.h>
#include <iupcontrols.h>
#include <cd.h>
#include <cdiup.h>
#include <im.h>
#include <im_image.h>

int main(int argc, char **argv) {
    IupOpen(&argc, &argv);
    IupControlsOpen();
    
    cdInitContextPlus();
    cdInitContextIup();
    
    imInitialize();

    Ihandle* dlg = IupLoad("example.led");
    if (!dlg) {
        IupMessage("Error", "Can't load LED file");
        return 1;
    }

    IupShowXY(dlg, IUP_CENTER, IUP_CENTER);

    IupMainLoop();

    IupClose();
    imFinialize();
    return 0;
}
```

********** example.led **********

``iupled
dialog = DIALOG[TITLE="IUP Controls Example"]
(
  VBOX
  (
    HBOX(LABEL[TITLE="Button:"], BUTTON[TITLE="Click Me"])
    HBOX(LABEL[TITLE="Toggle:"], TOGGLE[TITLE="On/Off"])
    HBOX(LABEL[TITLE="Text:"], TEXT[VALUE="Enter text here"])
    HBOX(LABEL[TITLE="List:"], LIST[1="Item 1", 2="Item 2", 3="Item 3"])
    HBOX(LABEL[TITLE="Tree:"], TREE[NAME="tree"])
    HBOX(LABEL[TITLE="Tabs:"], TABS(VBOX(LABEL[TITLE="Tab 1"]), 
VBOX(LABEL[TITLE="Tab 2"])))
    HBOX(LABEL[TITLE="Progress:"], PROGRESSBAR[VALUE="50"])
    HBOX(LABEL[TITLE="Val:"], VAL[MIN=0, MAX=100, VALUE=50])
    HBOX(LABEL[TITLE="Dial:"], DIAL[DENSITY=10])
    HBOX(LABEL[TITLE="Gauge:"], GAUGE[VALUE=0.7])
    HBOX(LABEL[TITLE="ColorBrowser:"], COLORBROWSER[])
    HBOX(LABEL[TITLE="MatrixEx:"], MATRIXEX[NUMCOL=3, NUMLIN=3])
    HBOX(LABEL[TITLE="GLCanvas:"], GLCANVAS[RASTERSIZE=100x100])
    HBOX(LABEL[TITLE="MglPlot:"], MGLPLOT[RASTERSIZE=200x150])
    HBOX(LABEL[TITLE="Plot:"], PLOT[RASTERSIZE=200x150])
  )
)
```

********* to build VisualStudio project files **********

1. Via the Start Menu, find an item named "Developer Command Prompt for VS 
[Your Version]" (e.g., "Developer Command Prompt for VS 2022").

2. Open it. You'll see a command prompt window with a message indicating it's 
set up the environment for Visual Studio.

3. Navigate to your project directory:
   ```
   cd path\to\your\project
   ```

4. Then, run the CMake command to generate your project files:
   ```
   mkdir build
   cd build
   cmake .. -G "Visual Studio 17 2022" -A x64
   ```

   (Adjust the Visual Studio version as needed to match the Command Prompt 
version you opened)

5. After CMake generates the files, you can either:
   - Open the .sln file in Visual Studio, or
   - Build from this same command prompt and still in the "build\" directory as 
above:

     ```
     cmake --build . --config Release
     ```
Or
     ```
     cmake --build . --config Debug
      

6. If you compiled via the command prompt as above, you can run the EXE via the 
appropriate path depending on the configuration you used

1. Debug Configuration:
   ```
   [project_root]\build\Debug\iup_example.exe
   ```

2. Release Configuration:
   ```
   [project_root]\build\Release\iup_example.exe
   ```

Hope this helps, and if not, please follow up!

IJR


Disclosure: These are tool-assisted instructions, heavily edited by me and with 
my own introduction based on several years of IUP usage as well as several 
years of C/C++ package management struggles. >_<


On Sat, Jul 27, 2024, at 6:52 AM, Алексей wrote:
Hello!
...snip...
When compiling a project, I receive messages:
...snip...





















_______________________________________________
Iup-users mailing list
Iup-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/iup-users

Reply via email to