#Raylib in VS
29 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
can u send the errors?
yes
also if you are using cmake please send the cmake script too
The main element is already defined in the losowegowno.obj element
no i dont
at least one multiply defined symbol was found
so did u use headerguards or did u include a header multiple times?
wait
no i have only one void main
can u
for the main function?
Because the main function cannot be void?
#include "raylib.h"
int main(void)
{
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");
SetTargetFPS(60);
while (!WindowShouldClose())
{
BeginDrawing();
ClearBackground(RAYWHITE);
DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);
EndDrawing();
}
CloseWindow();
return 0;
}
this is the whole code
so the code seems to be correct
can u send the compile output soemthing like this for example
x.cpp:1:1: error: ‘::main’ must return ‘int’
1 | void main() {}
| ^~~~
wait im new to vs where to find it?
so how do u compile your project
if u click the button like the compile button u can find the output in the output page
or in the problems tab
okej so let me translate it becouse it in polish
Compilation started at 12:18...
1>------ Compilation started: Project: randomwno, Configuration: Debug x64 ------
1>randomowegowno.cpp
1>main.cpp
1>Generating code...
1>main.obj : error LNK2005: Member main is already defined in member randomwno.obj
1>LINK : warning LNK4098: The default library "MSVCRT" conflicts with other libraries; use /NODEFAULTLIB:library
1>C:\Users\48721\Desktop\randomowegowno\x64\Debug\randomowegowno.exe : fatal error LNK1169: At least one multiply defined symbol found
1>Compiling project "randomowegowno.vcxproj" - FAILED. ========== Build: Success - 0, Failure - 1, Current - 0, Skipped - 0 ==========
========== Build - Completed at 12:18. Duration: 12.439 sec ==========
so for your information the other cpp file named randomowegowno.cpp is also being compiled and both contradict on the main function
So you can like move it to another folder or you can remove it from compiling
randomwno is a TU which defines the main function. And also the main.cpp is a TU which defined the main function. these two contradict because there needs to be one unique deceleration of the main function. meaning you have to remove it from compilation and linking or you can remove the main function (comment it even) from the file to let the project compile
thanks
you can mark this question as solved by doing !solved
happy to help
!solved