Makefile, C++ build error: forward declaration -
hello i'm pass construction var file function using create utility getting below error ppz help prepare it
1) var has incomplete type 2) header.h:error: foward declaration of struct st
here code:
header.h
#include<iostream> #include<stdio.h> using namespace std; void fn(struct st);
main.cpp
#include"header.h" struct st { int x; char s[10]; };
fn.cpp
#include"header.h" void fn(struct st var) { cout<<var.x<<var.s<<endl; }
makefile
all: hello hello: main.o fn.o g++ main.cpp fn.cpp main.o: main.cpp g++ -c main.cpp fn.o:fn.cpp g++ -c fn.cpp
move struct st declaration header.h
, before fn()
.
c++ makefile structure
No comments:
Post a Comment