[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] C++/Hello, World!



Hans Henrik Hansen wrote:
> Det er gemt som 'Hello.cpp', og ser ud til at kompilere OK - men når jeg
> vil køre det, sker følgende:

g++ Hello.cpp -o hello
./hello

burde virke. Glemmer du -o hello kompileres programmet til filen
a.out, som du så kan køre. 
 
> sslug@sslug:~> ./Hello.cpp
> ./Hello.cpp: using: command not found
> ./Hello.cpp: line 5: syntax error near unexpected token `main()'
> ./Hello.cpp: line 5: `int main() {'

Denne fejl kommer fordi shell forsøger at fortolke din C++ program
som et shellscript. Hvis du vil lave et hello world shell script
så skal du istedet skrive:

hello.sh
echo "Hello World"

Du kan så køre det med ./hello.sh
(evt. efter chmod +x hello.sh for at mærke det som executable)

-- 
          Mvh. Carsten Svaneborg
       http://www.softwarepatenter.dk
 hvor fremtidens idemonopoler bekæmpes idag.


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:09 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *