Skip to content
View in the app

A better way to browse. Learn more.

ResHax

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Help us keep the site running.

Cant compile any source code

Featured Replies

  • Author
  • Localization

tongbal, posted Tue Jan 22, 2019 4:37 pm (42643)


No matter what source code I use from https://aluigi.altervista.org/ , I always get mass errors. Im a beginner at programming and it seems no matter what IDE I use it gives me mass errors.
For example : https://aluigi.altervista.org/fakep/tcpfp.zip

Contains two files : winerr.h and tcpfp.c

Now I tried Visual Studio Code, started a new project and now this:

Code:
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\Dennis\AppData\Local\Temp\ccwJzarD.o:tcpfp.c:(.text 0x7): undefined reference to `WSAGetLastError@0'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\Dennis\AppData\Local\Temp\ccwJzarD.o:tcpfp.c:(.text 0x5ae): undefined reference to `WSAStartup@8'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\Dennis\AppData\Local\Temp\ccwJzarD.o:tcpfp.c:(.text 0x921): undefined reference to `htons@4'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\Dennis\AppData\Local\Temp\ccwJzarD.o:tcpfp.c:(.text 0x946): undefined reference to `ntohs@4'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\Dennis\AppData\Local\Temp\ccwJzarD.o:tcpfp.c:(.text 0x95a): undefined reference to `inet_ntoa@4'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\Dennis\AppData\Local\Temp\ccwJzarD.o:tcpfp.c:(.text 0x9c1): undefined reference to `socket@12'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\Dennis\AppData\Local\Temp\ccwJzarD.o:tcpfp.c:(.text 0x9ef): undefined reference to `connect@12'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\Dennis\AppData\Local\Temp\ccwJzarD.o:tcpfp.c:(.text 0xa06): undefined reference to `closesocket@4'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\Dennis\AppData\Local\Temp\ccwJzarD.o:tcpfp.c:(.text 0xc16): undefined reference to `__WSAFDIsSet@8'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\Dennis\AppData\Local\Temp\ccwJzarD.o:tcpfp.c:(.text 0xd23): undefined reference to `select@20'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\Dennis\AppData\Local\Temp\ccwJzarD.o:tcpfp.c:(.text 0xde8): undefined reference to `__WSAFDIsSet@8'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\Dennis\AppData\Local\Temp\ccwJzarD.o:tcpfp.c:(.text 0xe1c): undefined reference to `recv@16'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\Dennis\AppData\Local\Temp\ccwJzarD.o:tcpfp.c:(.text 0xfde): undefined reference to `socket@12'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\Dennis\AppData\Local\Temp\ccwJzarD.o:tcpfp.c:(.text 0x1049): undefined reference to `setsockopt@20'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\Dennis\AppData\Local\Temp\ccwJzarD.o:tcpfp.c:(.text 0x1077): undefined reference to `setsockopt@20'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\Dennis\AppData\Local\Temp\ccwJzarD.o:tcpfp.c:(.text 0x10a5): undefined reference to `setsockopt@20'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\Dennis\AppData\Local\Temp\ccwJzarD.o:tcpfp.c:(.text 0x10c5): undefined reference to `connect@12'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\Dennis\AppData\Local\Temp\ccwJzarD.o:tcpfp.c:(.text 0x10ff): undefined reference to `closesocket@4'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\Dennis\AppData\Local\Temp\ccwJzarD.o:tcpfp.c:(.text 0x1161): undefined reference to `send@16'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\Dennis\AppData\Local\Temp\ccwJzarD.o:tcpfp.c:(.text 0x119c): undefined reference to `closesocket@4'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\Dennis\AppData\Local\Temp\ccwJzarD.o:tcpfp.c:(.text 0x12c3): undefined reference to `closesocket@4'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\Dennis\AppData\Local\Temp\ccwJzarD.o:tcpfp.c:(.text 0x1432): undefined reference to `inet_addr@4'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\Dennis\AppData\Local\Temp\ccwJzarD.o:tcpfp.c:(.text 0x1449): undefined reference to `gethostbyname@4'


Suddenly I have to configure some weird tasks.json launch.json files, Internet description is a horror, tried many things and still wont work.

So ok next IDE. JetBrains CLion. Configured the path of Mingw. Now I start a new project with the files in the dir and now I cant even compile it because it says "CMake project is not loaded". What the hell.
When I look at your text at https://aluigi.altervista.org/about.htm it doesnt mention what IDE you use? And "I use ever and only Gcc and its Win32 port Mingw to compile my C stuff." So how do you do it? What if you have 10 or more files?

I cant even copy paste code and compile it please help
  • Author
  • Localization

aluigi, posted Tue Jan 22, 2019 11:11 pm (42667)


They aren't errors :)
"undefined reference" means that you must link the executable with the necessary libraries.
Add the following at the end of your gcc command-line and it will work:
-lws2_32

Example:
gcc -o file.exe file.c -s -O2 -lws2_32
  • Author
  • Localization

tongbal, posted Wed Jan 23, 2019 9:37 am (42681)


Thanks for the answer. I tried everything and this worked. I seem to get less errors in general from simple -gcc -o test test.cpp line than the big IDEs. Really weird, I expect theses big programs to make it easier not harder.
How do you use that command line if you are using like 20 files? Does this simple line work too?
  • Author
  • Localization

aluigi, posted Wed Jan 23, 2019 10:32 am (42684)


gcc -o file.exe *.c -s -O2 -lws2_32

:D
  • Author
  • Localization

tongbal, posted Wed Jan 23, 2019 2:22 pm (42692)


Is there a reason you prefer this over an IDE?

Edit: Also, there are a lot of things in Reverse Engineering (like Memory stuff) which wont work with gcc compiler and you need Microsoft visual 2017. I just tested it.
Gcc/clang gives error, VS doesnt.
I just uploaded a random .zip file which I get from some game hacking site which contains a project with 3 main files (2x cpp and 1 header) and you will not be able to compile it with your way. What do you do?

this.zip

  • Author
  • Localization

aluigi, posted Sun Jan 27, 2019 12:27 pm (42826)


I'm not used to work with IDE on gcc projects, that's why I go directly with the command-line.

If you prefer the "command-line way" with VS projects, you can.
Usually you have just to run "C:\Program Files (x86)\Microsoft Visual Studio XX.0\VC\vcvarsall.bat" which will set the environment and then call cl.exe with the necessary arguments.

I didn't check what's missing with the project you uploaded since I have limited time and it's not my code.
  • Author
  • Localization

tongbal, posted Mon Jan 28, 2019 5:48 pm (42881)


thanks for answer
Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.