Results 1 to 6 of 6

Thread: error: ‘Filename’ was not declared in this scope

  1. #1
    Join Date
    Feb 2018
    Beans
    2

    error: ‘Filename’ was not declared in this scope

    error: ‘Filename’ was not declared in this scope : gcc-c++


    spinning my wheels on this one - have checked out 6 or 7 similar issues through
    google searches but nothing seems related. have simplified the issue for this post:


    1. have a header file, CCDSFileManagerLNX.h, that is included by my main.cpp pgm:


    #include <stdio.h>


    class CDSFileManagerLNX{
    public:
    char* FileName;
    char* FileMode;

    FILE* pFile;

    void FileOpen();
    };


    2. have a cpp file, CCDSFileManagerLNX.cpp, that has been added to the project source files as it should:


    #include "/home/test/cds/ClassLibrary/CCDSFileManagerLNX.h"


    void CCDSFileManagerLNX::FileOpen(){
    FILE* pFile = fopen(Filename,FileMode);
    }


    3. when i attempt to runi get this:


    ../../cds/ClassLibrary/CCDSFileManagerLNX.cpp:4:21: error: ‘Filename’ was not
    declared in this scope
    FILE* pFile = fopen(Filename,FileMode);
    ^


    WHAT THE .... er hey???


    using netbeans ide on centos 7.4 and gcc - c++ compiler. thanks in advance for any
    insight.

  2. #2
    Join Date
    Jun 2006
    Location
    UK
    Beans
    Hidden!
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    Re: error: ‘Filename’ was not declared in this scope

    Quote Originally Posted by jimenright View Post
    using netbeans ide on centos 7.4
    Thread moved to Fedora/RedHat and derivatives.
    Ubuntu 20.04 Desktop Guide - Ubuntu 22.04 Desktop Guide - Forum Guide to BBCode - Using BBCode code tags

    Member: Not Canonical Team

    If you need help with your forum account, such as SSO login issues, username changes, etc, the correct place to contact an admin is here. Please do not PM me about these matters unless you have been asked to - unsolicited PMs concerning forum accounts will be ignored.

  3. #3
    Join Date
    Jul 2007
    Location
    Magic City of the Plains
    Beans
    Hidden!
    Distro
    Xubuntu Development Release

    Re: error: ‘Filename’ was not declared in this scope

    Centos support forums are here: https://www.centos.org/forums/

  4. #4
    Join Date
    Apr 2012
    Beans
    7,256

    Re: error: ‘Filename’ was not declared in this scope

    Isn't it just a typo? Filename is not the same thing as FileName

  5. #5
    Join Date
    Jul 2008
    Location
    The Left Coast of the USA
    Beans
    Hidden!
    Distro
    Kubuntu

    Re: error: ‘Filename’ was not declared in this scope

    ^^That appears to be it.

    Remember that case matters in c++.
    Please read The Forum Rules and The Forum Posting Guidelines

    A thing discovered and kept to oneself must be discovered time and again by others. A thing discovered and shared with others need be discovered only the once.
    This universe is crazy. I'm going back to my own.

  6. #6
    Join Date
    Feb 2018
    Beans
    2

    Re: error: ‘Filename’ was not declared in this scope

    doooooooooh - might you have something i can shoot myself with? appreciate your help!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •