I am trying to crosscompile simple hello world from Widows to Intel Edison via cmd. Instruction from here works perfectly. But I wont to use makefiles and where are not exists i586-poky-linux-make in this cross toolchain. So I decided to use mingw32-make from mingw32 binarys for Windows x86. Here is my simple makefile:
main: main.cpp
i586-poky-linux-gcc --sysroot=%POKY_HOME% main.cpp -o test -lstdc++ -O2
And... Iam getting an error
C:\Intel\iotdk-ide-win>mingw32-make
i586-poky-linux-gcc --sysroot=%POKY_HOME% main.cpp -o test -lstdc++
main.cpp:1:20: fatal error: iostream: No such file or directory
#include <iostream>
^
compilation terminated.
makefile:4: recipe for target 'main' failed
mingw32-make: *** [main] Error 1
How can I fix it? Thanks.
Related
Currently I am working on GnuWin32 rpcgen tool on Windows 10. My files get compiled and I am able to generate .o files for client and server. But It fails in the linking process. I am running following makefile by make -f Makefile. I am using cygwin tool on windows.
# Compiler flags
CC = gcc
CFLAGS += -g
LDLIBS += -lnsl
RPCGENFLAGS =
I am getting following error:
gcc -g -o ipg_rpc_client ipg_rpc_clnt.o ipg_rpc_client.o ipg_rpc_xdr.o -lnsl
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lnsl: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [Makefile.ipg_rpc:41: ipg_rpc_client] Error 1
please help in solving this error. From last week I am struggling on this.
Finally the error got solved.
I have downloaded libtirpc-devel from cygwin, and changed my LDLIBS in makefile to -ltirpc.
Now my exes got created.
I just started learning assembly, but when i tried to compile the code i just get an error.
I can make the object file with nasm -f win64 main.asm -o main.o but when i try to use ld -o main main.o or gcc -o main main.o i just get an error saying main.o: file not recognized: file format not recognized. I tried to use wsl and there ld worked fine but I don't want to use that whenever I need to compile.
I am running windows 10 64 bit.
It turned out that the toolchain I was using was 32-bit and only managed to link 32-bit object files while my object file was 64-bit. This caued my error and when I updated to a 64-bit toolchain it worked.
I've started writing my very own kernel and am developing on Windows 10.
I am using the following tools:
gcc 8.1.0 elf x86_64 for compiling my C code, and for linking.
I am using this Windows package.
nasm 2.14.02 for compiling my assembly code.
I am using the following command to build my freestanding kernel code:
gcc -c -m64 common/src/kernel.c -o common/build/kernel.o -std=gnu99 -ffreestanding -O2 -Wall -Wextra`
I am using the following command for compiling the root assembly code:
nasm -f elf64 targets/x86_64/src/main.asm -o targets/x86_64/build/main.o
Finally I link the object files together:
gcc -o dist/x86_64/main.bin -ffreestanding -O2 targets/x86_64/build/main.o common/build/kernel.o -lgcc
I haven't a clue why, but the following error is stopping the linking process from working:
... undefined reference to `WinMain'
collect2.exe: error: ld returned 1 exit status
This doesn't make sense to me because my compilation and linking is in freestanding mode and I am not attempting to use any windows APIs.
How do I fix this?
If it matters, here is my very simple code:
main.asm:
EXTERN kernel_main
call kernel_main
jmp $
; padding and magic number
times 510-($-$$) db 0
dw 0xaa55
kernel.c:
void kernel_main()
{
// empty
}
Edit: It looks like I might need the x86_64-elf-gcc compiler
Edit 2: I tried the x86_64-w64-mingw32-gcc compiler, same error occurs
I was missing the -nostdlib flag on the linker. This seems to have solved the problem.
I am using g++ version 4.8.5. I am trying to compile my project using it. It compiles without a problem, when compiling directly from the terminal. But, when using a make file, it gives me following error, even though I am using the same option.
cc1plus: error: unrecognized command line option "-std=c++11"
What am I doing wrong here ?
Edit:
as requested, here's my makefile line:
main: main.cc
#g++ -std=c++11 main.cpp -o run
Try using g++'s absolute path:
main: main.cc
#/usr/bin/g++-4.8 -std=c++11 main.cpp -o run
While trying to execute the simple hello world c++ program in V8 in ubuntu using the following command I am getting errors
the command is
g++ -Iv8/include hello_world.cpp -o hello_world.o
v8/out/native/obj.target/tools/gyp/libv8_base.a
v8/out/native/obj.target/tools/gyp/libv8_snapshot.a -lpthread
the error is
g++: error: v8/out/native/obj.target/tools/gyp/libv8_base.a: No such file or directory
g++: error: v8/out/native/obj.target/tools/gyp/libv8_snapshot.a: No such file or directory