[Tex/LaTex] Problem inserting bibliography in TexStudio

bibtexelsarticle

\documentclass[preprint,12pt,authoryear]{elsarticle}
\usepackage{amssymb}
\usepackage{lineno}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{natbib}

\bibliographystyle{elsarticle-harv}

\begin{document}

\begin{frontmatter}
\title{Wave Forces}
\end{frontmatter}

%% main text
\linenumbers
\section{Introduction}
\label{}
With tremendous population \cite{kee1997flexible}
\bibliography{bibby}
\end{document}

bibby.bib contains

@article{kee1997flexible,
    title={Flexible membrane wave barrier. {II}:~{Floating}\slash 
           submerged buoy-membrane system},
    author={Kee, S. T. and Kim, M. H.},
    journal={Journal of Waterway, Port, Coastal, and Ocean Engineering},
    volume={123},
    number={2},
    pages={82--90},
    year={1997},
    publisher={American Society of Civil Engineers}
}

the errors shown are

Process started: bibtex.exe "texstudio_hN6136"

This is BibTeX, Version 0.99d (MiKTeX 2.9.6350 64-bit)
The top-level auxiliary file: texstudio_hN6136.aux
The style file: elsarticle-harv.bst
I couldn't open database file bibby.bib
---line 4 of file texstudio_hN6136.aux
 : \bibdata{bibby
 :               }
I'm skipping whatever remains of this command
I found no database files---while reading file texstudio_hN6136.aux
Warning--I didn't find a database entry for "kee1997flexible"
(There were 2 error messages)

Process exited with error(s)



Process started: pdflatex.exe -synctex=1 -interaction=nonstopmode "texstudio_hN6136".tex

Process exited normally

Could someone help me where I am making mistake and Any help on properly inserting bibliography is highly appreciated.

Best Answer

If a new untitled .tex file is created in texstudio and not saved by the user prior to compiling, texstudio will automatically save it in a temporary location with a cryptic name such as the texstudio_hN6136 shown in your log file.

As your .bib file is not present in this temporary location, the error shown in your question will occur.

Solution: save the .tex file at a location and name of your choice before you compile.

Related Question