Find the answer to your Linux question:
Results 1 to 6 of 6
Hi, I have not error in visual C++ but when i want to compile using g++ in linux using: g++ -c pressure-correction.cpp BICG.cpp advance_Continuity.h solver_Setup.h initialize_MPI.h initialize_Variables.h BICG.h boundary_Conditions.h momentum_Predictor.h ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2012
    Posts
    2

    g++ tons of errors while no error in visualC++


    Hi,

    I have not error in visual C++ but when i want to compile using g++ in linux using:
    g++ -c pressure-correction.cpp BICG.cpp advance_Continuity.h solver_Setup.h initialize_MPI.h initialize_Variables.h BICG.h boundary_Conditions.h momentum_Predictor.h obtain_Velocities.h read_Grid_Setup.h getdeltap_Using_Energyequation.h update_Pressure_Momentum_Centervelocity_Facenormal velocity.h S1.h check_Convergence.h

    I get tons of errors like:
    S1.h:22:2: error: expected unqualified-id before ‘for’
    S1.h:22:15: error: ‘m’ does not name a type
    S1.h:22:49: error: ‘m’ does not name a type
    S1.h:26:7: error: expected unqualified-id before ‘for’
    S1.h:26:20: error: ‘i’ does not name a type
    S1.h:26:54: error: ‘i’ does not name a type
    S1.h:35:4: error: expected unqualified-id before ‘for’
    S1.h:35:17: error: ‘i’ does not name a type
    S1.h:35:51: error: ‘i’ does not name a type
    S1.h:474:2: error: ‘BICG_Solver’ does not name a type
    S1.h:475:2: error: ‘BICG_Solver’ does not name a type
    S1.h:476:2: error: ‘BICG_Solver’ does not name a type
    S1.h:477:2: error: ‘first’ does not name a type
    please help me
    Kind Regards,

    Farshad

  2. #2
    Linux Enthusiast
    Join Date
    Jan 2005
    Location
    Saint Paul, MN
    Posts
    675
    You will need to show some pf the code around the erroring lines if you really would like to get any aid here otherwise the only help would be like:
    Look at the line 22 in file S1 at column 2 to see what is before the token 'for'.

  3. #3
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,753
    Quote Originally Posted by alf55 View Post
    You will need to show some pf the code around the erroring lines if you really would like to get any aid here otherwise the only help would be like:
    Really. Without the relevant code, there isn't much we can do to help. Even posting the functions where the errors are occurring can be very illuminating. FWIW, Visual C++ is not particularly standards compliant. I know this because I have been writing cross-platform (Windows<->Unix<->Linux<->QNX) C code for 30 years, and C++ code for 20 years.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Enthusiast
    Join Date
    Jan 2005
    Location
    Saint Paul, MN
    Posts
    675
    Quote Originally Posted by Rubberman View Post
    Really. Without the relevant code, there isn't much we can do to help. Even posting the functions where the errors are occurring can be very illuminating. FWIW, Visual C++ is not particularly standards compliant. I know this because I have been writing cross-platform (Windows<->Unix<->Linux<->QNX) C code for 30 years, and C++ code for 20 years.
    Aparently Farshad_Noravesh did not think that including code was needed. He figured that you would be able to help him as is. I was trying to be polite.

  6. #5
    Just Joined!
    Join Date
    Dec 2012
    Posts
    2

    makefile problem

    Hi,

    I changed my makefile to as simple as this:

    #Makefile
    g++ -o sequential pressure-correction.cpp BICG.cpp advance_Continuity.h solver_Setup.h initialize_MPI.h initialize_Variables.h BICG.h boundary_Conditions.h momentum_Predictor.h obtain_Velocities.h read_Grid_Setup.h getdeltap_Using_Energyequation.h update_Pressure_Momentum_Centervelocity_Facenormal velocity.h S1.h check_Convergence.h

    Now the problem is:
    farshad@farshad:~/Documents/DNS-code$ make
    makefile:2: *** commands commence before first target. Stop.


    I know that it is about tab but i think i used tab in the first line.
    I have attached the makefile. please help me.
    sequential is the name of my output file to be used as a command.
    Thanks for your kind helps. I appreciate all of you kindly.
    Attached Files Attached Files

  7. #6
    Linux Enthusiast
    Join Date
    Jan 2005
    Location
    Saint Paul, MN
    Posts
    675
    S1.h:22:2: error: expected unqualified-id before ‘for’
    S1.h:22:15: error: ‘m’ does not name a type
    S1.h:22:49: error: ‘m’ does not name a type
    S1.h:26:7: error: expected unqualified-id before ‘for’
    S1.h:26:20: error: ‘i’ does not name a type
    S1.h:26:54: error: ‘i’ does not name a type
    S1.h:35:4: error: expected unqualified-id before ‘for’
    S1.h:35:17: error: ‘i’ does not name a type
    S1.h:35:51: error: ‘i’ does not name a type
    S1.h:474:2: error: ‘BICG_Solver’ does not name a type
    S1.h:475:2: error: ‘BICG_Solver’ does not name a type
    S1.h:476:2: error: ‘BICG_Solver’ does not name a type
    S1.h:477:2: error: ‘first’ does not name a type
    You started with errors in the code (file S1.h at lines 22, 26, 35, 474, 475, 476, and 47 and not the make file, now you have a bad makefile.
    makefile:2: *** commands commence before first target. Stop.
    The format of a make file is:
    Code:
    targetname: dependency list
              command_to_run
    The command line must use leading "tab" rather than spaces.

    When you run make, the first target (normally named "all") is run if you do not specify the target(s) to be run. Dependencies are files or targets.

    In your simplified makefile, you do not have a target.

    Also you should find the set of standard make targets (all, clean, distclean, etc) and use them when that action is written into your makefiles.

Posting Permissions

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