I'm having issues compiling a C program and running it on a Windows 7 64bit machine.
Here's my script:
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
bool isCaseSensitive = false;
enum { CHARACTER_MODE, WORD_MODE, LINE_MODE } mode = CHARACTER_MODE;
size_t optind;
for (optind = 1; optind < argc && argv[optind][0] == '-'; optind++)
{
switch(argv[optind][1])
{
case 'h': isCaseSensitive = true; printf("Help page"); break;
default:
fprintf(stderr, "Usage: %s [-h]\n", argv[0]);
exit(1);
}
}
}
Firstly I'm compiling this script using Ubuntu 16.04 over vmware with a Windows 7 host. When I run: gcc -m64 utilis.c -o utilis.exe
it will compile, but if I run it on my host I get this error:
If I try to compile it using 32bit, and having one of my buddies run it on his 32bit machine I get the following:
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.9/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.9/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
collect2: error: ld returned 1 exit status
If I have him run the 64bit one he gets this error:
What I've tried to do about this:
e@ubuntu:/mnt/hgfs/devshare/utilis$ sudo apt-get install build-essential
Reading package lists... Done
Building dependency tree
Reading state information... Done
build-essential is already the newest version (12.1ubuntu2).
0 upgraded, 0 newly installed, 0 to remove and 95 not upgraded.
e@ubuntu:/mnt/hgfs/devshare/utilis$ sudo apt-get install gcc-multilib
Reading package lists... Done
Building dependency tree
Reading state information... Done
gcc-multilib is already the newest version (4:5.3.1-1ubuntu1).
gcc-multilib set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 95 not upgraded.
e@ubuntu:/mnt/hgfs/devshare/utilis$ export LDFLAGS='-m32 -L/usr/lib32'
e@ubuntu:/mnt/hgfs/devshare/utilis$ export LDFLAGS='-m64 -L/usr/lib64'
e@ubuntu:/mnt/hgfs/devshare/utilis$ sudo apt-get install g++-multilib
Reading package lists... Done
Building dependency tree
Reading state information... Done
g++-multilib is already the newest version (4:5.3.1-1ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 95 not upgraded.
How can I get my program to compile correctly and be cross compatible to my Windows 7 machine?