#C++ how to format file contents?

32 messages · Page 1 of 1 (latest)

jolly mulch
#

cpudefs.h line 10 needs a semicolon as stated in the error

#

try moving your CPU class under the Registers class in the file

#

which one solved? just the semicolon, or both?

#

ah, a new error approaches

#

send it over

#

i haven't written C++ in like at least 5 yrs but i'll try to see if i can spot the issue haha

#

did you compile all the files?

#

can you see compiled artifacts for all your files?

#

I don't think the linker is getting your object output for the file where you define void Registers::clear_registers() { *pm.eax = 0; *pm.ebx = 0; *pm.ecx = 0; *pm.edx = 0; }
thats the issue i think you're getting, but my cpp is a bit rusty. I know @tawny nest would know, maybe he's around

#

it looks like it should work to me, i don't see any more obvious issues

#

he'll come when he does, don't wanna annoy the fella :3

tawny nest
#

i'm a fella :3

#

Sorry I in meeting I can look in a bit.

tawny nest
#

Why is it compiling to WASM lol

#

I guess it just be like that

#

Anyway I'd have to be more familiar with your build process and the thing you're using.

#

Can you make a simple example utilizing a header file and seeing it it works.

#

Like a struct foo in foo.h and then import and use it in main.cpp

tawny nest
#

Yeah so that's going to be a separate object file and need to be linked as an additional step.

#

That's why I'm hesitant and want to learn about how to build process works.

tawny nest
#

For separate compilation units, you'd compile with -c and then link together the object files after u make them all

#

um yes and no

#

you cna use a different command

#

but often times it will be the same command

#

since the compiler can do both, or delegate the task

#
CC := clang

all: ccc.exe

ccc.exe: main.o
    clang main.o -o ccc.exe

main.o: main.c
    clang -c main.c -o main.o
#

edited it a bit

#

Just am example of me building an object file.

#

And then turning it into an executable

#

it's a Makefile

#

it goes

target: dependencies
  recipe
tawny nest
#
clang++ -c ~/C++/x86/main.cpp -o ~/C++/x86/main.o
clang++ -c ~/C++/x86/cpu.cpp -o ~/C++/x86/cpu.o
clang++ ~/C++/x86/main.o ~/C++/x86/cpu.o -o ~/C++/x86/main.exe