Unable to compile the project in CodeBlocks using msys2

52 views
Skip to first unread message

Alex Tuchin

unread,
Mar 13, 2024, 4:50:22 AMMar 13
to dislin-users
Hello!
I receive a message during compilation:
g++.exe -LN:\MyProgramming\Dislin\ -o bin\Debug\Dislin.exe obj\Debug\exa_cpp_test.o  -m64  N:\MyProgramming\Dislin\discyg_d.a N:\MyProgramming\Dislin\disgpp.a
N:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: N:\MyProgramming\Dislin\disgpp.a(disini.o):dis_win.cpp:(.text+0x46): undefined reference to `__getreent'.
I probably connected the libraries from the distribution incorrectly, but I don't know how to connect them correctly.
Please help me fix the project.
Dislin.zip

Helmut Michels

unread,
Mar 13, 2024, 5:23:19 AMMar 13
to dislin-users
Dear Alex,

I think that you are using the wrong Dislin libraries. You are compiling with a Mingw port of the
g++ compiler, but are linking with the Dislin libraries for a Cygwin port. You have to use the
Dislin libraries of the distribution dl_11_mg.zip instead of dl_11_gc.zip.

With best regards,

Helmut

Alex Tuchin

unread,
Mar 13, 2024, 6:17:31 AMMar 13
to dislin-users
Do I understand correctly that in the mode Debug and Release I  need to connect discpp.a and discppu.a, in the mode Release additionally dismg.a and dismgu.a, in the mode Debug  additionally  dismg_d.a and  dismgu_d.a? 

среда, 13 марта 2024 г. в 12:23:19 UTC+3, mic...@dislin-software.de:

Helmut Michels

unread,
Mar 13, 2024, 10:59:20 AMMar 13
to dislin-users
No, you only need one of these libraries. The library dismg.a is for c and gfortran programming,
the library discpp.a for g++ programming. The special library versions dismgu.a and discppu.a
are necessary if your compiler supports the ucrt environment instead of  msvcrt. I think that
your compiler uses the msvcrt environment since it is located in the mingw64 directory tree
and not in ucrt64. You can check it out with gcc -v. All Dislin libraries are compiled for Release
mode, but are normally also working in Debug mode.

With best regards,

Helmut

Alex Tuchin

unread,
Mar 13, 2024, 2:33:11 PMMar 13
to dislin-users
Dear Helmut!
Thanks a lot for the answers and help!
Unfortunately, it didn't work out. I'm getting a message:
-------------- Build: Release in Dislin (compiler: GNU GCC Compiler)---------------
g++.exe -Wall -m64 -fexceptions -std=c++20 -O2 -Wall -IN:\MyProgramming\Dislin -c N:\MyProgramming\Dislin\exa_cpp.cpp -o obj\Release\exa_cpp.o
g++.exe -LN:\MyProgramming\Dislin -o bin\Release\Dislin.exe obj\Release\exa_cpp.o  -m64 -s  N:\MyProgramming\Dislin\discpp.a
N:\MyProgramming\Dislin\exa_cpp.cpp: In function 'void exa_10()':
N:\MyProgramming\Dislin\exa_cpp.cpp:579:10: warning: variable 'nl' set but not used [-Wunused-but-set-variable]
  579 | { int i, nl;
      |          ^~
N:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: N:\MyProgramming\Dislin\discpp.a(qqwini.o):qqw_win.c:(.text+0x255c): undefined reference to `__imp_glRasterPos2i'
N:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: N:\MyProgramming\Dislin\discpp.a(qqwini.o):qqw_win.c:(.text+0x2584): undefined reference to `__imp_glDrawPixels'
............................................... (many other type errors " undefined reference")
With best regards, Alex
среда, 13 марта 2024 г. в 17:59:20 UTC+3, mic...@dislin-software.de:
Dislin.zip

Helmut Michels

unread,
Mar 13, 2024, 4:44:14 PMMar 13
to dislin-users
Dear Alex,

the warning is harmless, but the undefined references are caused by a missing OpenGL library
in the link command. You have to add the option -lopengl32 to the link command.

With best regards,

Helmut

Alex Tuchin

unread,
Mar 14, 2024, 1:19:32 PMMar 14
to dislin-users
Dear Helmut.

Unfortunately, it also didn't work out with -lopengl32. I'm getting a message:
g++.exe -Wall -m64 -fexceptions -std=c++20 -g -Wall  -c N:\MyProgramming\Dislin\exa_cpp.cpp -o obj\Debug\exa_cpp.o
g++.exe  -o bin\Debug\Dislin.exe obj\Debug\exa_cpp.o  -m64 -lopengl32  N:\MyProgramming\Dislin\discpp.a

N:\MyProgramming\Dislin\exa_cpp.cpp: In function 'void exa_10()':
N:\MyProgramming\Dislin\exa_cpp.cpp:579:10: warning: variable 'nl' set but not used [-Wunused-but-set-variable]
  579 | { int i, nl;
      |          ^~
N:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: N:\MyProgramming\Dislin\discpp.a(qqwini.o):qqw_win.c:(.text+0x255c): undefined reference to `__imp_glRasterPos2i'
N:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: N:\MyProgramming\Dislin\discpp.a(qqwini.o):qqw_win.c:(.text+0x2584): undefined reference to `__imp_glDrawPixels'
..............................................................................................
With best regards, Alex

среда, 13 марта 2024 г. в 23:44:14 UTC+3, mic...@dislin-software.de:

Helmut Michels

unread,
Mar 14, 2024, 1:41:47 PMMar 14
to dislin-users
Dear Alex,

please set the option -lopengl32 after the Dislin library discpp.a, not before.

With best regards,

Helmut

Alex Tuchin

unread,
Mar 15, 2024, 3:35:30 AMMar 15
to dislin-users

Dear Helmut.

Unfortunately, it also didn't work:
g++.exe -Wall -m64 -fexceptions -std=c++20 -g -Wall  -c N:\MyProgramming\Dislin\exa_cpp.cpp -o obj\Debug\exa_cpp.o
g++.exe  -o bin\Debug\Dislin.exe obj\Debug\exa_cpp.o  -m64 N:\MyProgramming\Dislin\discpp.a -lopengl32  

N:\MyProgramming\Dislin\exa_cpp.cpp: In function 'void exa_10()':
N:\MyProgramming\Dislin\exa_cpp.cpp:579:10: warning: variable 'nl' set but not used [-Wunused-but-set-variable]
  579 | { int i, nl;
      |          ^~
N:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: N:\MyProgramming\Dislin\discpp.a(qqwini.o):qqw_win.c:(.text+0x2656): undefined reference to `__imp_SetPixel'
N:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: N:\MyProgramming\Dislin\discpp.a(qqwini.o):qqw_win.c:(.text+0x280d): undefined reference to `__imp_SetPixel'
--------------------------------------------------------
With best regards, Alex

четверг, 14 марта 2024 г. в 20:41:47 UTC+3, mic...@dislin-software.de:

Alex Tuchin

unread,
Mar 15, 2024, 4:40:35 AMMar 15
to dislin-users
Dear Helmut.

As I understand it, I do not have the necessary libraries connected to the project. How can we understand from the compiler messages which additional libraries are required? Maybe I need to install additional libraries using msys2 and connect them?

With best regards, Alex
пятница, 15 марта 2024 г. в 10:35:30 UTC+3, Alex Tuchin:

Helmut Michels

unread,
Mar 15, 2024, 5:47:15 AMMar 15
to dislin-users
Dear Alex,

the system libraries required by Dislin are user32, gdi32 and opengl32. It looks like that the OpenGL
functions are now found by the linker. SetPixel is included in the gdi32 library. Please add the options
-luser32 -lgdi32 -lopengl32 to your linker command (after the Dislin library). Don't be suprised about
the term '32' in the library names. For 64-bit programming the 64-bit versions of these libraries are
used.

With best regards,

Helmut

Helmut Michels

unread,
Mar 15, 2024, 5:57:09 AMMar 15
to dislin-users
Alex,

I think that you have already installed all necessary system libraries for Dislin with your compiler.
You only have to specify them in your linking command. A search for a undefined reference in the internet
tells you to which library the function belongs. You can also take to look at the Dislin linking
scripts (cpplink, clink, f90link) to see how linking is done.

With best regards,

Helmut    

Alex Tuchin

unread,
Mar 15, 2024, 7:04:13 AMMar 15
to dislin-users
Dear Helmut.

Thank you very much! It finally worked out. I should have seen earlier the mcplink.bat to connect the necessary libraries immediately.

With best regards, Alex

пятница, 15 марта 2024 г. в 12:57:09 UTC+3, mic...@dislin-software.de:

Global Psychedelic

unread,
Apr 21, 2024, 12:33:43 AMApr 21
to dislin-users
Mushrooms contain macronutrients that support a healthy immune system. According to the Mushroom Council, your immune system will benefit from mushrooms whose nutrients include: Selenium, which helps your body make antioxidant enzymes to prevent cell damage. Choose cremini or portabella mushrooms for the most benefit.😋


Check my telegram group for more information 

https://t.me/exotics_shop_1



Buy FIREMAN online 
https://t.me/exotics_shop_1/103
Buy lucky kush online 
https://t.me/exotics_shop_1/113
Buy gello gelato online 
https://t.me/exotics_shop_1/114
Buy grape fanta online 
https://t.me/exotics_shop_1/103
Buy tiramesu smalls online 
https://t.me/exotics_shop_1/97
Buy icebergs online
https://t.me/exotics_shop_1/107?single
Buy dabwoods × runtz disposable online 
https://t.me/exotics_shop_1/115?single
Buy wax crumble online 
https://t.me/exotics_shop_1/120?single
Buy golden teacher online 🍄
https://t.me/exotics_shop_1/121?single
Buy 3 grams runtz disposable vapes online 
https://t.me/exotics_shop_1/126?single
Buy polkadot bars online 
https://t.me/exotics_shop_1/128
Buy mushrooms online 
https://t.me/exotics_shop_1/130?single
Buy rosin dot bars online 
https://t.me/exotics_shop_1/132
Buy kiwano (heavy loadz) online 
https://t.me/exotics_shop_1/133?single
Buy mix and match d9  edibles online 
https://t.me/exotics_shop_1/137?single
Buy black cherry online 
https://t.me/exotics_shop_1/140
Buy FIREMAN 
Clone card available 
https://t.me/exotics_shop_1/169
Buy lsd sheets online 
https://t.me/exotics_shop_1/172
Buy polkatdot starter pack 🍄 online
https://t.me/exotics_shop_1/178?single
Buy edible candy online 
https://t.me/exotics_shop_1/180
Buy potent carbs 
https://t.me/exotics_shop_1/190?single
Buy persy snowcaps online 
https://t.me/exotics_shop_1/193?single
Buy galactic gummies online 
https://t.me/exotics_shop_1/210
Buy new cake cards online 
https://t.me/exotics_shop_1/214?single
Buy pure mdma online 
https://t.me/exotics_shop_1/215
Buy distillate online 
https://t.me/exotics_shop_1/217
Buy crumble online 
https://t.me/exotics_shop_1/218
Buy codeine online 
https://t.me/exotics_shop_1/221?single
Buy quagen online 
https://t.me/exotics_shop_1/223?single
Buy jeeter dispos online 
https://t.me/exotics_shop_1/230?single
Buy Columbia coke online 
https://t.me/exotics_shop_1/238
Buy inhale excellence online 
https://t.me/exotics_shop_1/103
Buy lucky kush online 
https://t.me/exotics_shop_1/113
Buy gello gelato online 
https://t.me/exotics_shop_1/114
Buy grape fanta online 
https://t.me/exotics_shop_1/103
Buy tiramesu smalls online 
https://t.me/exotics_shop_1/97
Buy icebergs online 
https://t.me/exotics_shop_1/107?single
https://t.me/exotics_shop_1/281?single
https://t.me/exotics_shop_1/282?single
https://t.me/exotics_shop_1/291
https://t.me/exotics_shop_1/292
https://t.me/exotics_shop_1/296
https://t.me/exotics_shop_1/299
https://t.me/exotics_shop_1/301

"Our commitment is to provide exceptional service, unparalleled quality, and personalized solutions to meet your unique needs. We strive to exceed your expectations and deliver results that make a lasting impact. Trust us to be your reliable partner in achieving your goals. Your satisfaction is our utmost priority."
Reply all
Reply to author
Forward
0 new messages