Issue in C++ course

Hi @Cryptoscoot, hope you are ok.

The compiler said “error in codeline 14”, if you see your code line # 14, you cout is missing the proper closing tag << also the endl

Carlos Z.

1 Like

Yes, Thank you.
I have that working but how do I re-route a file name for Code Blocks after moving the file to a different file location in my computer.?

I know how to get and copy the path but can’t find where to make that change on Code Blocks?

The files paths in a project are relative so as long as they remain in the same location within the project folder it should be fine. Moving the project folder is ok.

If you moved files within the project folder with codeblocks, it should fix the paths by itself. If you moved them in the explorer then check for files like Makefile or other project files, open them with a text editor and update the path manually. :slight_smile:

1 Like

Hey, I have a problem. I write the code exactly as in the course on C++ structs. But I don’t get any output.

#include <iostream>

using namespace std;

struct Person {
    string name;
    int age;
    string gender;
};

void printPersonInfo (Person p) {
    cout << "The name of the person is " << p.name << endl;
    cout << "The age of the person is " << p.age << endl;
    cout << "The gender of the person is " << p.gender << endl;
}

int main()
{

    // Person ivan = {"Ivan", 21, "male"};
    Person ivan;
    ivan.name = "Ivan";
    ivan.age = 21;
    ivan.gender = "male";

    Person josh;
    ivan.name = "Josh";
    ivan.age = 25;
    ivan.gender = "male";

    printPersonInfo(ivan);

    return 0;
}

My output however is empty like in the screenshot. Screen Shot 2021-01-12 at 23.59.18

I ran the same code on windows as well and I again get no outputs.

Hi, from the output its not visible what are you intending to do. Are you trying to compile or run the program?

In either case the program you are trying to run doesn’t exist or is not in the path you are located.

1 Like

Hey. Thanks for commenting and pointing me in the right direction! I tried changing folders and renaming it. Now it works. Not sure exactly why, because then I saved it again in the folder from the first try (when it didn’t work) it was just renamed in a way that it contains 0 spaces - before it was “structs and classes” and now it is “structsAndClasses”.

Could it be that it didn’t work because of naming the project with spaces?

image

1 Like

Glad you made it work! :raised_hands: probably, some shells don’t handle app names with spaces well. :slight_smile: