Help with using header files please in code::blocks

I tried making a header file with this
#ifndef helloworld2_h
#define helloworld2_h

int bobo(int x, int d, int f)
{
return x+d+f;
}
#endif


and then I saved this and manually put it into another file to use it as a header in this.

#include <iostream>

#include "helloworld2.h"

int main()
{
std::cout << "The sum of 3 and 4 is " << std::endl;
return 0;
}

but when I compile this I'm brought to a new page that I didn't make with this code, and ond on the first line there is an error saying "expected unqualified-id before "<" token. Can anyone help me solve this so I can learn to use headers? I don't understand why this isn't compiling and would very much appreciate help please.

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="helloworld2.cpp" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Debug">
<Option output="bin/Debug/helloworld2" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Debug/" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-g" />
</Compiler>
</Target>
<Target title="Release">
<Option output="bin/Release/helloworld2" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Release/" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-O2" />
</Compiler>
<Linker>
<Add option="-s" />
</Linker>
</Target>
</Build>
<Compiler>
<Add option="-Wall" />
<Add option="-fexceptions" />
</Compiler>
<Unit filename="main.cpp" />
<Extensions>
<code_completion />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>

<Option compiler="gcc" />

It looks like you're compiling with the C compiler instead of C++. The GNU C++ compiler is g++, not gcc.
Topic archived. No new replies allowed.