New Posts  All Forums:Forum Nav:

compile in unix help

post #1 of 5
Thread Starter 
I have the following files:
header files:
a.h
b.h
c.h
d.h
e.h
f.h

.cpp files:
main.cpp
f.cpp


in main.cpp, I have included all six header files and in f.cpp i have included f.h header file.

I can compile without any errors in visual studio, but couldn't in unix command line client(putty). Can anyone please explain how to make a makefile to do this or what are the commands to compile them manually? Thanks!
    
CPUGraphicsRAMHard Drive
Intel Core i7 4870HQ 2.5GHz AMD Radeon R9 M370X 2048 MB 16 GB 1600 MHz DDR3 1TB SSD 
OS
macOS Sierra 
  hide details  
Reply
    
CPUGraphicsRAMHard Drive
Intel Core i7 4870HQ 2.5GHz AMD Radeon R9 M370X 2048 MB 16 GB 1600 MHz DDR3 1TB SSD 
OS
macOS Sierra 
  hide details  
Reply
post #2 of 5
what did you type into the command line to compile your project?



all a makefile does is make it easier to compile large projects with many many files using the make command.
Black Silence
(15 items)
 
  
CPUMotherboardRAMHard Drive
i5 3570k @ 4.5 GHz Asus P8Z77-M Pro Kingston HyperX Genesis 8 GB - 1600 MHz Seagate Barracuda 250 GB 
Optical DriveCoolingOSMonitor
Samsung WriteMaster Noctua NH-D14 Windows 10 ASUS VS24AH-P 
KeyboardPowerCaseMouse
Logitech Navigator Enermax Infiniti 650W Fractal R3 Black Pearl Razer Death Adder 
Mouse PadAudio
SteelSeries QcK Mass Altec Lansing FX4021 
  hide details  
Reply
Black Silence
(15 items)
 
  
CPUMotherboardRAMHard Drive
i5 3570k @ 4.5 GHz Asus P8Z77-M Pro Kingston HyperX Genesis 8 GB - 1600 MHz Seagate Barracuda 250 GB 
Optical DriveCoolingOSMonitor
Samsung WriteMaster Noctua NH-D14 Windows 10 ASUS VS24AH-P 
KeyboardPowerCaseMouse
Logitech Navigator Enermax Infiniti 650W Fractal R3 Black Pearl Razer Death Adder 
Mouse PadAudio
SteelSeries QcK Mass Altec Lansing FX4021 
  hide details  
Reply
post #3 of 5
Thread Starter 
g++ main.cpp f.cpp -o filename
    
CPUGraphicsRAMHard Drive
Intel Core i7 4870HQ 2.5GHz AMD Radeon R9 M370X 2048 MB 16 GB 1600 MHz DDR3 1TB SSD 
OS
macOS Sierra 
  hide details  
Reply
    
CPUGraphicsRAMHard Drive
Intel Core i7 4870HQ 2.5GHz AMD Radeon R9 M370X 2048 MB 16 GB 1600 MHz DDR3 1TB SSD 
OS
macOS Sierra 
  hide details  
Reply
post #4 of 5
try just this and get back to me...
Code:
g++ main.cpp f.cpp
Black Silence
(15 items)
 
  
CPUMotherboardRAMHard Drive
i5 3570k @ 4.5 GHz Asus P8Z77-M Pro Kingston HyperX Genesis 8 GB - 1600 MHz Seagate Barracuda 250 GB 
Optical DriveCoolingOSMonitor
Samsung WriteMaster Noctua NH-D14 Windows 10 ASUS VS24AH-P 
KeyboardPowerCaseMouse
Logitech Navigator Enermax Infiniti 650W Fractal R3 Black Pearl Razer Death Adder 
Mouse PadAudio
SteelSeries QcK Mass Altec Lansing FX4021 
  hide details  
Reply
Black Silence
(15 items)
 
  
CPUMotherboardRAMHard Drive
i5 3570k @ 4.5 GHz Asus P8Z77-M Pro Kingston HyperX Genesis 8 GB - 1600 MHz Seagate Barracuda 250 GB 
Optical DriveCoolingOSMonitor
Samsung WriteMaster Noctua NH-D14 Windows 10 ASUS VS24AH-P 
KeyboardPowerCaseMouse
Logitech Navigator Enermax Infiniti 650W Fractal R3 Black Pearl Razer Death Adder 
Mouse PadAudio
SteelSeries QcK Mass Altec Lansing FX4021 
  hide details  
Reply
post #5 of 5
What error do you get from gcc? If you're using some external libraries you may need to add -l, eg g++ -lboost or something. Also why would you have 6 header files for 2 cpp files?
buka
(17 items)
 
  
Reply
buka
(17 items)
 
  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming